From 1473745cf39e94933179276a6d533bff2ceff79d Mon Sep 17 00:00:00 2001
From: zs <zhousong@weben-smart.com>
Date: 周二, 06 5月 2025 16:22:55 +0800
Subject: [PATCH] 任务管理
---
PipeLineLems/web/src/utils/request.ts | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/PipeLineLems/web/src/utils/request.ts b/PipeLineLems/web/src/utils/request.ts
index 506c8e4..83e0bbd 100644
--- a/PipeLineLems/web/src/utils/request.ts
+++ b/PipeLineLems/web/src/utils/request.ts
@@ -1,6 +1,5 @@
import { default as axios, AxiosRequestConfig } from 'axios'
import { Session } from '@/utils/storage'
-import router from '@/router'
// 閰嶇疆鏂板缓涓�涓� axios 瀹炰緥
const service = axios.create({
@@ -9,7 +8,7 @@
headers: {
'Content-Type': 'application/json;charset=UTF-8',
'X-Requested-With': 'XMLHttpRequest',
- 'Accept-Language': 'zh-Hans'
+ 'Accept-Language': 'zh-Hans',
},
})
@@ -20,7 +19,7 @@
// console.log('Token', token);
if (token) config.headers['Authorization'] = `Bearer ${token}`
config.headers['X-Requested-With'] = 'XMLHttpRequest'
- if (typeof config.data !== 'object') config.data = JSON.stringify(config.data)
+ // if (typeof config.data !== 'object') config.data = JSON.stringify(config.data)
return config
},
(error: any) => {
@@ -31,16 +30,16 @@
// 鍝嶅簲鍚�
service.interceptors.response.use(
(response: any) => {
- const { data } = response;
+ const { data } = response
// if (data.statusCode == 401) {
// ElMessage.error('璇风櫥褰�');
// router.push({ name: '/login' })
// return;
// }
- return data;
+ return data
},
(error: any) => {
- Session.remove('Token')
+ // Session.remove('Token')
return Promise.reject(error)
}
)
@@ -51,10 +50,17 @@
<D = Data>(url: string, config?: AxiosRequestConfig): Promise<D>
get<D = Data>(url: string, config?: AxiosRequestConfig): Promise<D>
delete<D = Data>(url: string, config?: AxiosRequestConfig): Promise<D>
- post<D = Data>(url: string, data?: any, config?: AxiosRequestConfig): Promise<D>
- put<D = Data>(url: string, data?: any, config?: AxiosRequestConfig): Promise<D>
+ post<D = Data>(
+ url: string,
+ data?: any,
+ config?: AxiosRequestConfig
+ ): Promise<D>
+ put<D = Data>(
+ url: string,
+ data?: any,
+ config?: AxiosRequestConfig
+ ): Promise<D>
} & typeof service
const request = service as Request
export { request as default, request }
-
--
Gitblit v1.9.3