refactor:管理员登录接口返回的路由路径使用的字面量改为变量

This commit is contained in:
妙码生花 2023-11-12 16:31:49 +08:00
parent ea524c542d
commit bcb72e4d86
2 changed files with 3 additions and 3 deletions

View File

@ -102,8 +102,7 @@ class Index extends Backend
$res = $this->auth->login($username, $password, (bool)$keep);
if ($res === true) {
$this->success(__('Login succeeded!'), [
'userInfo' => $this->auth->getInfo(),
'routePath' => '/admin'
'userInfo' => $this->auth->getInfo()
]);
} else {
$msg = $this->auth->getError();

View File

@ -86,6 +86,7 @@ import router from '/@/router'
import clickCaptcha from '/@/components/clickCaptcha'
import toggleDark from '/@/utils/useDark'
import { fullUrl } from '/@/utils/common'
import { adminBaseRoutePath } from '/@/router/static/adminBase'
let timer: number
const config = useConfig()
@ -161,7 +162,7 @@ const onSubmit = (captchaInfo = '') => {
login('post', form)
.then((res) => {
adminInfo.dataFill(res.data.userInfo)
router.push({ path: res.data.routePath })
router.push({ path: adminBaseRoutePath })
})
.finally(() => {
state.submitLoading = false