|
|
@ -23,6 +23,9 @@ import { useGlobal } from '#imports' |
|
|
|
export default defineNuxtRouteMiddleware((to, from) => { |
|
|
|
export default defineNuxtRouteMiddleware((to, from) => { |
|
|
|
const state = useGlobal() |
|
|
|
const state = useGlobal() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** if shred base allow without validating token */ |
|
|
|
|
|
|
|
if (to.params?.projectType === 'base') return |
|
|
|
|
|
|
|
|
|
|
|
/** 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) { |
|
|
|
return navigateTo('/signin') |
|
|
|
return navigateTo('/signin') |
|
|
|