This commit is contained in:
weiwei committed 2025-08-15 15:53:48 +08:00
1 parent bcb2d91447
commit a8c03e3089
1 file changed
+6 -6
+6 -6
View File
@@ -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<boolean> {
// 请求函数
const request = (config: any) => {
return http.middleware(config)
return https.middleware(config)
}
export default request