From f7e76d780e8bf1cdd75ac9742b9be3baa0b8ba9e Mon Sep 17 00:00:00 2001 From: xingyy <373639591@qq.com> Date: Thu, 7 Dec 2023 11:18:53 +0800 Subject: [PATCH] submit --- src/http/init.ts | 16 +++++++++------- src/http/main.ts | 2 -- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/http/init.ts b/src/http/init.ts index af3d2a96..b67950a0 100644 --- a/src/http/init.ts +++ b/src/http/init.ts @@ -1,13 +1,14 @@ import {uniFetch} from "@/http/main"; -const fetch=new uniFetch({ - baseUrl:'https://warehouse.szjixun.cn', - interceptors:{ - //请求拦截器 - request(config ){ - }, +const fetch = new uniFetch({ + baseUrl: 'https://warehouse.szjixun.cn', + interceptors: { + //请求拦截器 + request(config) { + return config + }, //响应拦截器 - response(response){ + response(response) { if (response.data?.status === 401) { let curPage = getCurrentPages(); let route = curPage[curPage.length - 1].route; //获取当前页面的路由 @@ -17,6 +18,7 @@ const fetch=new uniFetch({ }); } } + return response } } }) diff --git a/src/http/main.ts b/src/http/main.ts index 625030a8..cf7e6dab 100644 --- a/src/http/main.ts +++ b/src/http/main.ts @@ -141,6 +141,4 @@ class uniFetch { return this.request(this.buildRequestOptions(options)); } } - - export { uniFetch}