First commit
This commit is contained in:
7
frontend/app/middleware/auth.ts
Normal file
7
frontend/app/middleware/auth.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { authToken } from '~/utils/auth'
|
||||
|
||||
export default defineNuxtRouteMiddleware(to => {
|
||||
const token = import.meta.server ? useCookie('commander-auth-token').value : authToken()
|
||||
if (token) return
|
||||
return navigateTo({ path: '/account', query: { next: to.fullPath } })
|
||||
})
|
||||
Reference in New Issue
Block a user