12 lines
272 B
TypeScript
12 lines
272 B
TypeScript
export default defineNuxtPlugin(async () => {
|
|
const { restoreFromCache, checkAuth, setAuthReady } = useAuth()
|
|
|
|
restoreFromCache()
|
|
|
|
const hasAuthCookie = document.cookie.includes('auth-token')
|
|
if (hasAuthCookie) {
|
|
await checkAuth()
|
|
}
|
|
|
|
setAuthReady(true)
|
|
})
|