opnform/client/middleware/check-auth.global.js

6 lines
170 B
JavaScript

export default defineNuxtRouteMiddleware((to, from) => {
const authStore = useAuthStore()
authStore.loadTokenFromCookie()
useAuthStore().fetchUserIfNotFetched()
})