Reputation: 57
When I verified my e-mail already, the checkboxes in the local store don't change.
**** VUEX****
async confirmEmail({ commit }) {
try {
const user = auth.currentUser;
if (user) {
await user.reload();
if (user.emailVerified) {
commit('SET_IS_USER_REGISTERED', true);
commit('setShowNotification', false);
localStorage.setItem('isUserRegistered', 'true');
localStorage.setItem('setShowNotification', 'false');
return { success: true, message: 'Your e-mail address has been verified.' };
} else {
await sendEmailVerification(user);
return { success: false, message: 'Please check your email for confirmation.' };
}
} else {
throw new Error('User not found');
}
} catch (error) {
throw new Error('Mail Confirmation Error: ' + error.message);
}
},
};
Component
onMounted(() => {
store.dispatch('admin/fetchCategories');
const registered = localStorage.getItem('isUserRegistered');
if (registered === 'true') {
store.commit('auth/SET_IS_USER_REGISTERED', true);
store.commit('auth/setShowNotification', false);
}
});
when email is already verified, the checkboxes are not changed in localstorage and notification is not lost.
Upvotes: 0
Views: 23