11 lines
328 B
TypeScript
11 lines
328 B
TypeScript
export default defineNuxtRouteMiddleware((to, from) => {
|
|
const accessToken = useCookie('access_token').value;
|
|
|
|
const isPublicRoute =
|
|
['/auth/login'].includes(to.path) ||
|
|
to.path.startsWith('/auth/activation/');
|
|
|
|
if (!accessToken && !isPublicRoute) {
|
|
return navigateTo('/auth/login');
|
|
}
|
|
}) |