feat: 单点登录

This commit is contained in:
GAOANG
2024-05-24 16:39:37 +08:00
parent 631995de04
commit f77f3c9ec5
4 changed files with 34 additions and 4 deletions

View File

@ -131,11 +131,12 @@ export const useUserStore = defineStore({
): Promise<GetUserInfoModel | null> {
try {
const data = await singleLoginApi(params, params.mode);
const userInfo = await this.getUserInfoAction();
const { token } = data;
// save token
this.setToken(token);
router.replace(params.targetURL)
router.replace(params.targetURL || params.redirect || userInfo?.homePath || PageEnum.BASE_HOME)
return await this.afterLoginAction(false);
} catch (error) {