From 5edf21b1edd467314083c8f394673160fa7a1ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=82=A0=E9=9D=99=E8=90=9D=E8=8E=89?= Date: Wed, 22 Jun 2022 20:18:07 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B7=BB=E5=8A=A0=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E5=B9=B6=E5=88=A0=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index 7e527de..a2a664b 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,4 +1,4 @@ -import axios from 'axios'; +import axios, { AxiosInstance } from 'axios'; import proxy from '../config/proxy'; const env = import.meta.env.MODE || 'development'; @@ -8,19 +8,15 @@ const host = env === 'mock' ? '/' : proxy[env].host; // 如果是mock模式 就 const CODE = { LOGIN_TIMEOUT: 1000, REQUEST_SUCCESS: 0, - REQUEST_FOBID: 1001, + REQUEST_FAILED: 1001, }; -const instance = axios.create({ +const instance: AxiosInstance = axios.create({ baseURL: host, - timeout: 1000, + timeout: 5000, withCredentials: true, }); -instance.interceptors.request.use((config) => config); - -instance.defaults.timeout = 5000; - instance.interceptors.response.use( (response) => { if (response.status === 200) {