This commit is contained in:
Your Name
2026-03-01 14:17:59 +08:00
parent 65aa12f146
commit a07e844c47
6071 changed files with 777651 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import { useAppStore } from '~~/stores/app'
import { useUserStore } from '~~/stores/user'
import { isEmptyObject } from '~~/utils/validate'
export default defineNuxtRouteMiddleware(async (to, from) => {
const userStore = useUserStore()
const appStore = useAppStore()
try {
if (isEmptyObject(appStore.config)) {
await appStore.getConfig()
}
if (userStore.isLogin && isEmptyObject(userStore.userInfo)) {
await userStore.getUser()
}
} catch (error) {
userStore.$reset()
}
})