7 lines
312 B
TypeScript
7 lines
312 B
TypeScript
// app/plugins/auth.client.ts - 客户端启动时拉取一次 session,供全局复用
|
|
// .client.ts 后缀确保只在浏览器端执行,避免 SSR 阶段因无 cookie 而误判未登录
|
|
export default defineNuxtPlugin(async () => {
|
|
const authStore = useAuthStore();
|
|
await authStore.fetchSession();
|
|
});
|