2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 11:27:17 +08:00

feat: 优化已登录自动跳转仪表盘

This commit is contained in:
耗子
2025-02-09 15:51:42 +08:00
parent 2293646c4c
commit c527af97ca
2 changed files with 15 additions and 19 deletions

View File

@@ -30,7 +30,7 @@ export const http = createAlova({
console.log(json)
const message = resolveResError(
code,
json?.message && json.message.trim() !== '' ? json.message : statusText
(typeof json?.message === 'string' && json.message.trim()) || statusText
)
const noAlert = meta?.noAlert
if (!noAlert) {

View File

@@ -65,7 +65,7 @@ async function handleLogin() {
await addDynamicRoutes()
useRequest(user.info()).onSuccess(({ data }) => {
userStore.set(data)
userStore.set(data as any)
})
if (query.redirect) {
const path = query.redirect as string
@@ -78,25 +78,21 @@ async function handleLogin() {
loging.value = false
}
watch(
() => isLogin,
async () => {
if (isLogin) {
console.log(isLogin)
await addDynamicRoutes()
useRequest(user.info()).onSuccess(({ data }) => {
userStore.set(data)
})
if (query.redirect) {
const path = query.redirect as string
Reflect.deleteProperty(query, 'redirect')
await router.push({ path, query })
} else {
await router.push('/')
}
watch(isLogin, async () => {
if (isLogin) {
await addDynamicRoutes()
useRequest(user.info()).onSuccess(({ data }) => {
userStore.set(data as any)
})
if (query.redirect) {
const path = query.redirect as string
Reflect.deleteProperty(query, 'redirect')
await router.push({ path, query })
} else {
await router.push('/')
}
}
)
})
</script>
<template>