Browse Source

Merge pull request #3254 from nocodb/refactor/gui-v2-first-user-navigation

refactor(gui-v2): navigate to signup page if first user
pull/3281/head
Pranav C 2 years ago committed by GitHub
parent
commit
7df497ff76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      packages/nc-gui-v2/middleware/auth.global.ts

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

@ -47,6 +47,11 @@ export default defineNuxtRouteMiddleware(async (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 this is the first usern navigate to signup page directly */
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