Client - allow user to change email

This commit is contained in:
Sam
2022-03-12 08:59:22 +01:00
parent 42dfeee283
commit ae0b9c36b2
15 changed files with 247 additions and 49 deletions

View File

@ -79,6 +79,14 @@ const routes: Array<RouteRecordRaw> = [
),
props: { action: 'reset' },
},
{
path: '/email-update',
name: 'EmailUpdate',
component: () =>
import(
/* webpackChunkName: 'profile' */ '@/views/user/EmailUpdateView.vue'
),
},
{
path: '/profile',
name: 'Profile',
@ -254,16 +262,22 @@ const pathsWithoutAuthentication = [
'/register',
]
const paths = ['/email-update']
router.beforeEach((to, from, next) => {
store
.dispatch(AUTH_USER_STORE.ACTIONS.CHECK_AUTH_USER)
.then(() => {
if (paths.includes(to.path)) {
return next()
}
if (
store.getters[AUTH_USER_STORE.GETTERS.IS_AUTHENTICATED] &&
pathsWithoutAuthentication.includes(to.path)
) {
return next('/')
} else if (
}
if (
!store.getters[AUTH_USER_STORE.GETTERS.IS_AUTHENTICATED] &&
!pathsWithoutAuthentication.includes(to.path)
) {