|
@@ -4,7 +4,9 @@ import { RouteLocationNormalized } from 'vue-router';
|
|
|
import { useMessage } from '../web/useMessage';
|
|
|
import { AUTO_LOGIN_URL_QUERY } from '/@/router/constant';
|
|
|
import { AxiosError } from 'axios';
|
|
|
-import { tokenLogin } from '/@/api/sys/user';
|
|
|
+import { tokenLogin, getUserInfo } from '/@/api/sys/user';
|
|
|
+import { isArray } from '/@/utils/is';
|
|
|
+import { RoleEnum } from '/@/enums/roleEnum';
|
|
|
|
|
|
/** 自动登录功能的Hook,该Hook是为了部署在同一局域网内的多套系统之间能够无缝切换 */
|
|
|
export function useAutoLogin() {
|
|
@@ -74,11 +76,9 @@ export function useAutoLogin() {
|
|
|
}
|
|
|
|
|
|
async function doTokenLogin(token: string) {
|
|
|
- const res = await tokenLogin({ token });
|
|
|
- if (res['success']) {
|
|
|
- userStore.setToken(token);
|
|
|
- userStore.setUserInfo(res['']);
|
|
|
- }
|
|
|
+ await tokenLogin({ token });
|
|
|
+ userStore.setToken(token);
|
|
|
+ await userStore.getUserInfoAction();
|
|
|
}
|
|
|
|
|
|
return {
|