feat: update authentication flow and user navigation
This commit is contained in:
@@ -37,14 +37,12 @@ export const useAuth = () => {
|
||||
try {
|
||||
const res = await fetchCurrentUser()
|
||||
if (res.ok) {
|
||||
console.log('[Auth] User synced successfully')
|
||||
user.value = res.user
|
||||
|
||||
if (res.user.must_change_password && route.path !== '/auth/change-password') {
|
||||
console.log('[Auth] User must change password, redirecting...')
|
||||
await nuxtApp.runWithContext(() => navigateTo('/auth/change-password'))
|
||||
} else if (redirectOnSuccess && route.path.startsWith('/auth')) {
|
||||
await nuxtApp.runWithContext(() => navigateTo('/me'))
|
||||
await nuxtApp.runWithContext(() => navigateTo('/dashboard'))
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -115,4 +113,4 @@ export const useAuth = () => {
|
||||
fetchNotifications,
|
||||
markNotificationRead,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user