File tree Expand file tree Collapse file tree 3 files changed +5
-1
lines changed Expand file tree Collapse file tree 3 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -35,9 +35,11 @@ class RequestHttp {
35
35
*/
36
36
this . service . interceptors . request . use (
37
37
( config : AxiosRequestConfig ) => {
38
+ console . log ( config ) ;
38
39
// * 将当前请求添加到 pending 中
39
40
axiosCanceler . addPending ( config ) ;
40
- showFullScreenLoading ( ) ;
41
+ // * 如果当前请求不需要显示 loading(在headers中指定 notLoading:true)
42
+ config . headers ! . notLoading || showFullScreenLoading ( ) ;
41
43
const token : string = globalStore . token ;
42
44
return { ...config , headers : { "x-access-token" : token } } ;
43
45
} ,
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import http from "@/api";
8
8
*/
9
9
// * 用户登录接口
10
10
export const loginApi = ( params : Login . ReqLoginForm ) => {
11
+ // return http.post<Login.ResLogin>(PORT1 + `/login`, params, { headers: { notLoading: true } });
11
12
return http . post < Login . ResLogin > ( PORT1 + `/login` , params ) ;
12
13
} ;
13
14
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export const addUser = (params: { id: string }) => {
19
19
20
20
// * 批量添加用户
21
21
export const BatchAddUser = ( params : any ) => {
22
+ // 其实 headers 中的 Content-Type 可以不写,请求可以自动判断,这里为了演示,写了一下
22
23
return http . post ( PORT1 + `/user/import` , params , { headers : { "Content-Type" : ContentTypeEnum . FORM_DATA } } ) ;
23
24
} ;
24
25
You can’t perform that action at this time.
0 commit comments