register
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
const accessToken = useCookie('access_token').value;
|
||||
|
||||
if (!accessToken && to.path !== '/auth/login') {
|
||||
const isPublicRoute =
|
||||
['/auth/login'].includes(to.path) ||
|
||||
to.path.startsWith('/auth/activation/');
|
||||
|
||||
if (!accessToken && !isPublicRoute) {
|
||||
return navigateTo('/auth/login');
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user