Commit 834fa7eb9c8aff252e083d38fdab4f6f53b4d43a
1 parent
56628042
fix(axios): make sure that the parameter is an object before processing, fix #660
Showing
1 changed file
with
5 additions
and
1 deletions
src/utils/http/axios/helper.ts
@@ -21,7 +21,11 @@ export function createNow(join: boolean, restful = false): string | object { | @@ -21,7 +21,11 @@ export function createNow(join: boolean, restful = false): string | object { | ||
21 | /** | 21 | /** |
22 | * @description: Format request parameter time | 22 | * @description: Format request parameter time |
23 | */ | 23 | */ |
24 | -export function formatRequestDate(params: any) { | 24 | +export function formatRequestDate(params: Recordable) { |
25 | + if (Object.prototype.toString.call(params) !== '[object Object]') { | ||
26 | + return; | ||
27 | + } | ||
28 | + | ||
25 | for (const key in params) { | 29 | for (const key in params) { |
26 | if (params[key] && params[key]._isAMomentObject) { | 30 | if (params[key] && params[key]._isAMomentObject) { |
27 | params[key] = params[key].format(DATE_TIME_FORMAT); | 31 | params[key] = params[key].format(DATE_TIME_FORMAT); |