|
@@ -46,10 +46,10 @@ axios.interceptors.request.use(async (config) => {
|
|
|
|
|
|
const { token, userId } = getAuth();
|
|
const { token, userId } = getAuth();
|
|
let caseId = router.currentRoute.value?.params?.caseId
|
|
let caseId = router.currentRoute.value?.params?.caseId
|
|
- console.log("token",getAuth, token, "userId", userId, config.url);
|
|
|
|
|
|
+ console.log("token",localStorage.getItem('token'), token, "userId", userId, config.url);
|
|
if (!token && !~notLoginUrls.indexOf(config.url)) {
|
|
if (!token && !~notLoginUrls.indexOf(config.url)) {
|
|
// router.replace({ name: RouteName.login });
|
|
// router.replace({ name: RouteName.login });
|
|
- let redirect = encodeURIComponent(`${window.location.origin}/mix3d/#/home/${caseId}`);
|
|
|
|
|
|
+ let redirect = encodeURIComponent(`${window.location.href}`);
|
|
window.location.href = window.location.origin + "/admin/#/login?redirect=" + redirect;
|
|
window.location.href = window.location.origin + "/admin/#/login?redirect=" + redirect;
|
|
throw "用户未登录";
|
|
throw "用户未登录";
|
|
}
|
|
}
|
|
@@ -96,8 +96,7 @@ const responseInterceptor = (res: AxiosResponse<any, any>) => {
|
|
~unAuthCode.indexOf(res.data.code) ||
|
|
~unAuthCode.indexOf(res.data.code) ||
|
|
errMsg === "token已经失效,请重新登录"
|
|
errMsg === "token已经失效,请重新登录"
|
|
) {
|
|
) {
|
|
- let caseId = router.currentRoute.value?.params?.caseId
|
|
|
|
- let redirect = encodeURIComponent(`${window.location.origin}/mix3d/#/home/${caseId}`);
|
|
|
|
|
|
+ let redirect = encodeURIComponent(`${window.location.href}`);
|
|
window.location.href = window.location.origin + "/admin/#/login?redirect=" + redirect;
|
|
window.location.href = window.location.origin + "/admin/#/login?redirect=" + redirect;
|
|
// router.replace({ name: RouteName.login });
|
|
// router.replace({ name: RouteName.login });
|
|
getAuth().clear();
|
|
getAuth().clear();
|