From aa7b39eb9cada77179a4b60be18428a29096aaec Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 20 Aug 2022 00:18:38 +0530 Subject: [PATCH] refactor(gui-v2): navigate to signup page if first user Signed-off-by: Pranav C --- packages/nc-gui-v2/middleware/auth.global.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/nc-gui-v2/middleware/auth.global.ts b/packages/nc-gui-v2/middleware/auth.global.ts index 8c85c53571..785791011c 100644 --- a/packages/nc-gui-v2/middleware/auth.global.ts +++ b/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 ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !state.signedIn.value) { + if (state.appInfo?.value?.firstUser) { + return navigateTo('/signup') + } return navigateTo('/signin') } else if (to.meta.requiresAuth === false && state.signedIn.value) { /**