2026-01-16 16:37:16 +07:00
|
|
|
export default defineNuxtPlugin({
|
|
|
|
|
name: 'auth-restore',
|
|
|
|
|
parallel: false,
|
2026-01-23 09:53:39 +07:00
|
|
|
async setup() {
|
2026-01-16 16:37:16 +07:00
|
|
|
const authStore = useAuthStore();
|
|
|
|
|
|
|
|
|
|
// Restore auth state from cookies on app initialization
|
2026-01-23 09:53:39 +07:00
|
|
|
// Now async - will attempt to refresh token if needed
|
|
|
|
|
await authStore.checkAuth();
|
2026-01-16 16:37:16 +07:00
|
|
|
}
|
|
|
|
|
});
|