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