Conf(拦截器):设置超时时长为2分钟

This commit is contained in:
lifizer
2024-11-29 15:43:14 +08:00
parent e48762c783
commit 088f3ea370
+2 -1
View File
@@ -8,7 +8,7 @@ const http = new Request();
/* 设置全局配置 */ /* 设置全局配置 */
http.setConfig((config) => { http.setConfig((config) => {
config.baseURL = VUE_APP_API_URL; config.baseURL = VUE_APP_API_URL;
config.timeout = 2000; config.timeout = 2 * 60 * 1000;
config.method = "POST"; config.method = "POST";
config.responseType = "text"; config.responseType = "text";
config.header = { config.header = {
@@ -34,6 +34,7 @@ http.interceptors.response.use(
return response; return response;
}, },
(error) => { (error) => {
console.log(error)
if (error.toString() == "Error: Network Error") { if (error.toString() == "Error: Network Error") {
console.log("————————"); console.log("————————");
console.log("发送请求失败", error); console.log("发送请求失败", error);