update 调整权限问题
This commit is contained in:
+7
-7
@@ -1,27 +1,27 @@
|
||||
import axios from 'axios';
|
||||
import { getAppEnvConfig } from '/@/utils/env.ts';
|
||||
import { useUserStoreWithOut } from '/@/store/modules/user.ts';
|
||||
import { getAuthCache } from '/@/utils/auth.ts';
|
||||
import { TOKEN_KEY } from '/@/enum/cacheEnum.ts';
|
||||
import { useMessage } from '/@/hooks/web/useMessage.ts';
|
||||
import { checkStatus } from '/@/api/checkStatus.ts';
|
||||
import router from '/@/router';
|
||||
import { useUserStore } from '/@/store/modules/user.ts';
|
||||
import { getBaseLogin, toLoginByNowPath } from '/@/enum/pageEnum.ts';
|
||||
|
||||
const { createMessage, createErrorModal } = useMessage();
|
||||
const { createMessage } = useMessage();
|
||||
const { VITE_GLOB_API_URL } = getAppEnvConfig();
|
||||
const userStore = useUserStoreWithOut();
|
||||
const token = userStore.getToken;
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: VITE_GLOB_API_URL,
|
||||
timeout: 50000,
|
||||
headers: {
|
||||
// 设置后端需要的传参类型
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
'X-Access-Token': token || getAuthCache(TOKEN_KEY),
|
||||
'X-Access-Token': getAuthCache(TOKEN_KEY),
|
||||
},
|
||||
});
|
||||
service.interceptors.request.use((config, options) => {
|
||||
const userStore = useUserStore();
|
||||
const token = userStore.getToken;
|
||||
config.headers['X-Access-Token'] = token || getAuthCache(TOKEN_KEY);
|
||||
return config;
|
||||
});
|
||||
@@ -37,7 +37,7 @@ service.interceptors.response.use(
|
||||
if (!path) {
|
||||
path = toLoginByNowPath(router.currentRoute.value.path);
|
||||
}
|
||||
createMessage.warn(error.response.data.message);
|
||||
// createMessage.warn(error.response.data.message);
|
||||
router.replace({
|
||||
path: path,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user