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