项目微调

优化封装的Axios
This commit is contained in:
2024-10-10 11:29:48 +08:00
parent abbda880df
commit b6659f5ae9

View File

@@ -18,13 +18,15 @@ const config = {
// 设置超时时间
timeout: ResultEnum.TIMEOUT as number,
// 跨域时候允许携带凭证
withCredentials: true
withCredentials: true,
// post请求指定数据类型以及编码
headers: { 'Content-Type': 'application/json;charset=utf-8' }
};
class RequestHttp {
service: AxiosInstance;
public constructor(config: AxiosRequestConfig) {
// instantiation
// 创建实例
this.service = axios.create(config);
/**