store
This commit is contained in:
parent
85207f8ad2
commit
8d1319164e
@ -1,11 +1,16 @@
|
|||||||
export default defineNuxtRouteMiddleware((to, from) => {
|
export default defineNuxtRouteMiddleware((to, from) => {
|
||||||
const accessToken = useCookie('access_token').value;
|
try {
|
||||||
|
const accessToken = useCookie('access_token').value;
|
||||||
|
|
||||||
const isPublicRoute =
|
const isPublicRoute =
|
||||||
['/auth/login'].includes(to.path) ||
|
['/auth/login'].includes(to.path) ||
|
||||||
to.path.startsWith('/auth/activation/');
|
to.path.startsWith('/auth/activation/');
|
||||||
|
|
||||||
if (!accessToken && !isPublicRoute) {
|
if (!accessToken && !isPublicRoute) {
|
||||||
|
return navigateTo('/auth/login');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Auth middleware error:', error);
|
||||||
return navigateTo('/auth/login');
|
return navigateTo('/auth/login');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -33,8 +33,10 @@
|
|||||||
<NuxtLink to="/" class="block w-8 lg:hidden">
|
<NuxtLink to="/" class="block w-8 lg:hidden">
|
||||||
<img src="/assets/images/logo.svg" alt="Logo" class="mx-auto w-10" />
|
<img src="/assets/images/logo.svg" alt="Logo" class="mx-auto w-10" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<div class="dropdown ms-auto w-max">
|
<client-only>
|
||||||
<client-only>
|
<template #default>
|
||||||
|
<div class="dropdown ms-auto w-max" v-if="store">
|
||||||
|
|
||||||
<Popper :placement="store.rtlClass === 'rtl' ? 'bottom-start' : 'bottom-end'" offsetDistance="8">
|
<Popper :placement="store.rtlClass === 'rtl' ? 'bottom-start' : 'bottom-end'" offsetDistance="8">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@ -72,8 +74,9 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
</Popper>
|
</Popper>
|
||||||
</client-only>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
|
</client-only>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full max-w-[440px] lg:mt-16">
|
<div class="w-full max-w-[440px] lg:mt-16">
|
||||||
<div class="mb-10">
|
<div class="mb-10">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user