'add exception to vue navigation gards

I have a project buit in laravel and vue I added forgot password reset system. the system sends email password reset link. but when I click the link it redirects to login page the vue router navigation guard code is

router.beforeEach((to, _, next) => {
    const isLoggedIn = isUserLoggedIn()
    //console.log('can navigate', to, canNavigate(to))
    if(to.name=='auth-reset-password'){
        return {name:'auth-reset-password'}
    }
    if (!canNavigate(to)) {
        // Redirect to login if not logged in
    
        if (!isLoggedIn) return next({ name: 'auth-login' })

        // If logged in => not authorized
        return next({ name: 'misc-not-authorized' })
    }

    // Redirect if logged in
    if (to.meta.redirectIfLoggedIn && isLoggedIn) {
        const userData = getUserData()
        next(getHomeRouteForLoggedInUser(userData ? userData.role : null))
    }

    return next()
})

how do I add exception to router.beforeEach of password reset



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source