Browse Source

refactor(gui-v2): navigate to signup page if first user

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3254/head
Pranav C 2 years ago
parent
commit
aa7b39eb9c
  1. 3
      packages/nc-gui-v2/middleware/auth.global.ts

3
packages/nc-gui-v2/middleware/auth.global.ts

@ -33,6 +33,9 @@ export default defineNuxtRouteMiddleware((to, from) => {
/** if auth is required or unspecified (same as required) and user is not signed in, redirect to signin page */ /** if auth is required or unspecified (same as required) and user is not signed in, redirect to signin page */
if ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !state.signedIn.value) { if ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !state.signedIn.value) {
if (state.appInfo?.value?.firstUser) {
return navigateTo('/signup')
}
return navigateTo('/signin') return navigateTo('/signin')
} else if (to.meta.requiresAuth === false && state.signedIn.value) { } else if (to.meta.requiresAuth === false && state.signedIn.value) {
/** /**

Loading…
Cancel
Save