Browse Source

fix(gui-v2): fix infinite middleware loop

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
pull/2716/head
Braks 2 years ago committed by Pranav C
parent
commit
136f20b174
  1. 6
      packages/nc-gui-v2/middleware/auth.global.ts

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

@ -10,6 +10,10 @@ export default defineNuxtRouteMiddleware((to, from) => {
if ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !$state.signedIn.value) { if ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !$state.signedIn.value) {
return navigateTo('/signin') return navigateTo('/signin')
} else if (to.meta.requiresAuth === false && $state.signedIn.value) { } else if (to.meta.requiresAuth === false && $state.signedIn.value) {
return navigateTo(from.path) if (from.meta.requiresAuth === false) {
return navigateTo('/')
} else {
return navigateTo(from.path)
}
} }
}) })

Loading…
Cancel
Save