1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import axios, { AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
|
||||
import { Session } from '/@/utils/storage';
|
||||
import { useMessageBox } from '/@/hooks/message';
|
||||
import {useMessage, useMessageBox} from '/@/hooks/message';
|
||||
import qs from 'qs';
|
||||
import other from './other';
|
||||
import {paramsFilter} from "/@/flow";
|
||||
@@ -85,6 +85,7 @@ service.interceptors.request.use(
|
||||
* @returns 如果响应成功,则返回响应的data属性;否则,抛出错误或者执行其他操作
|
||||
*/
|
||||
const handleResponse = (response: AxiosResponse<any>) => {
|
||||
console.log("response",response)
|
||||
if (response.data.code === 1) {
|
||||
throw response.data;
|
||||
}
|
||||
@@ -125,6 +126,10 @@ service.interceptors.response.use(handleResponse, (error) => {
|
||||
return;
|
||||
});
|
||||
}
|
||||
if ((status == 500 || status == 400) && error.response && error.response.data && error.response.data.msg) {
|
||||
useMessage().error(error.response.data.msg);
|
||||
return Promise.reject(error.response.data);
|
||||
}
|
||||
|
||||
// 针对密文返回解密
|
||||
if (error.response?.data?.encryption) {
|
||||
|
||||
Reference in New Issue
Block a user