更新
This commit is contained in:
@@ -13,12 +13,12 @@ import { stringify } from "qs";
|
||||
import NProgress from "../progress";
|
||||
import { getToken, formatToken } from "@/utils/auth";
|
||||
import { useUserStoreHook } from "@/store/modules/user";
|
||||
import { baseUrlApi } from './httpConfig.ts'
|
||||
import { baseUrlApi } from "./httpConfig.ts";
|
||||
import { message } from "../message";
|
||||
// 相关配置请参考:www.axios-js.com/zh-cn/docs/#axios-request-config-1
|
||||
const defaultConfig: AxiosRequestConfig = {
|
||||
// 请求超时时间
|
||||
timeout: 10000,
|
||||
timeout: 30000,
|
||||
headers: {
|
||||
Accept: "application/json, text/plain, */*",
|
||||
"Content-Type": "multipart/form-data",
|
||||
@@ -163,12 +163,12 @@ class PureHttp {
|
||||
return new Promise((resolve, reject) => {
|
||||
PureHttp.axiosInstance
|
||||
.request(config)
|
||||
.then((response) => {
|
||||
.then(response => {
|
||||
// console.log(response)
|
||||
if ([301, 302].includes(response.code)) {
|
||||
message(response.msg, 'error')
|
||||
message(response.msg, "error");
|
||||
useUserStoreHook().logOut();
|
||||
return
|
||||
return;
|
||||
}
|
||||
resolve(response);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user