test_lgq/web/middleware/auth.ts
2024-01-24 17:36:08 +08:00

6 lines
165 B
TypeScript

export default defineNuxtRouteMiddleware((to, from) => {
if (!getToken()) {
useLogin().setLoginBack(to)
return navigateTo('/auth/login')
}
})