From a8c03e3089d64c122c4d68c0578cfbf7b3d16a66 Mon Sep 17 00:00:00 2001 From: weiwei Date: Fri, 15 Aug 2025 15:53:48 +0800 Subject: [PATCH] --- src/sheep/utils/request.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sheep/utils/request.ts b/src/sheep/utils/request.ts index d9fcf64..e59c207 100644 --- a/src/sheep/utils/request.ts +++ b/src/sheep/utils/request.ts @@ -27,8 +27,8 @@ const processQueue = (error: any, token: any = null) => { } } -// 创建http请求实例 -const http = new Request({ +// 创建https请求实例 +const https = new Request({ baseURL: import.meta.env.VITE_API_URL, timeout: 15000, method: "GET", @@ -47,7 +47,7 @@ const http = new Request({ }, }) -http.interceptors.request.use(async (config) => { +https.interceptors.request.use(async (config) => { const tokenStorage = uni.getStorageSync(TOKEN_KEY) const config_header: any = config.header || {} @@ -84,7 +84,7 @@ http.interceptors.request.use(async (config) => { }, Promise.reject) // 响应拦截器 -http.interceptors.response.use( +https.interceptors.response.use( async (response) => { // 账号密码登录响应结果特殊处理 if (response.config.url === "/auth/oauth2/token") { @@ -113,7 +113,7 @@ http.interceptors.response.use( const config = error.config const tokenValue = getTokenValue(newTokenStorage) if (tokenValue && config.header) config.header.Authorization = tokenValue - return http.request(config) + return https.request(config) } } catch (err) { return Promise.reject(err) @@ -284,7 +284,7 @@ async function loginBySh(): Promise { // 请求函数 const request = (config: any) => { - return http.middleware(config) + return https.middleware(config) } export default request