mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 11:27:17 +08:00
feat: 优化已登录自动跳转仪表盘
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user