feat: update authentication flow and user navigation

This commit is contained in:
2026-06-13 17:15:59 +02:00 Unverified
parent ab6455345e
commit a66339a7fc
18 changed files with 662 additions and 759 deletions
+2 -4
View File
@@ -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,
}
}
}