feat: 新增路由代码

This commit is contained in:
valarchie
2023-06-29 23:00:44 +08:00
parent 03d9b2b6f8
commit 4d41bccfbf
5 changed files with 27 additions and 16 deletions

View File

@@ -31,7 +31,9 @@ import {
getIsRememberMe,
savePassword,
getPassword,
removePassword
removePassword,
setToken,
DataInfo
} from "@/utils/auth";
import dayIcon from "@/assets/svg/day.svg?component";
@@ -81,6 +83,13 @@ const onLogin = async (formEl: FormInstance | undefined) => {
captchaCodeKey: ruleForm.captchaCodeKey
}).then(res => {
if (res.code === 0) {
// 登录成功后 将token存储到sessionStorage中
const tokenData: DataInfo<Number> = {
accessToken: res.data.token,
expires: undefined,
refreshToken: ""
};
setToken(tokenData);
// 获取后端路由
initRouter().then(() => {
router.push(getTopMenu(true).path);