I have a problem editing the 'email' field. When I click change mail, the email changes correctly, but when I want to log in again, the new email is not working, only the old one is still working. How to do it so that after clicking on change email it will change in the database so that after logging in again the new email will work. I do not know how to do this. I have this code.
<template>
<div class="editemail">
<div class="container">
<form class="form" @submit.prevent>
<!-- email -->
<label for="email" class="form__label">Email</label>
<input
class="form__input"
type="text"
id="email"
name="email"
:placeholder="userProfile.email"
v-model.trim="email"
/>
<button class="form__button" type="submit" @click="editEmail()">
Zmień email
</button>
</form>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex';
import * as firebase from '../firebase';
export default {
data() {
return {
email: '',
};
},
computed: {
...mapState(['userProfile']),
},
methods: {
editEmail() {
firebase.usersCollection.doc(firebase.auth.currentUser.uid).update({
email: this.email,
});
},
},
};
</script>