12 lines
276 B
TypeScript
12 lines
276 B
TypeScript
export default defineNuxtRouteMiddleware((to) => {
|
|
if (to.meta.public) return
|
|
|
|
const { $pinia } = useNuxtApp()
|
|
if (import.meta.client) {
|
|
const userStore = useUserStore($pinia)
|
|
if (!userStore.isAuthenticated) {
|
|
return navigateTo('/auth/login')
|
|
}
|
|
}
|
|
})
|