fix(admin): restore session via /auth/me in router guard (refresh no longer logs out); simplify member price table (no title/source/action columns)

This commit is contained in:
yeuimu
2026-08-28 17:02:25 +08:00
parent 9863346c6d
commit c2d50c9fa3
2 changed files with 7 additions and 28 deletions
+6 -1
View File
@@ -32,10 +32,15 @@ const router = createRouter({
routes,
})
router.beforeEach((to) => {
router.beforeEach(async (to) => {
const authStore = useAuthStore()
const isPublic = to.meta?.public === true
// 会话在 HttpOnly cookie 里:刷新后先经 /auth/me 恢复登录态,再判定是否放行
if (!authStore.isLoggedIn && !isPublic) {
await authStore.ensureSessionChecked()
}
if (!authStore.isLoggedIn && !isPublic) {
return { path: '/login', replace: true }
}