|
@@ -75,6 +75,14 @@ export class Interceptors {
|
|
|
if (hasLogin) {
|
|
|
console.error('错误接口:' + res.request.responseURL)
|
|
|
const exportLog = () => {
|
|
|
+ let params = res.config.data
|
|
|
+ if (res.config.data instanceof FormData) {
|
|
|
+ const obj = {}
|
|
|
+ res.config.data.entries().forEach((v: any) => {
|
|
|
+ obj[v[0]] = v[1]
|
|
|
+ })
|
|
|
+ params = obj
|
|
|
+ }
|
|
|
let str = ''
|
|
|
const arr = [
|
|
|
`错误日期:${YMDHms(res.headers.date)}`,
|
|
@@ -82,7 +90,7 @@ export class Interceptors {
|
|
|
`接口地址:${res.request.responseURL}`,
|
|
|
`接口状态:${res.status} ${res.statusText}`,
|
|
|
`请求Token:${res.config.headers.Authorization}`,
|
|
|
- `请求参数:${res.config.data || ''}`,
|
|
|
+ `请求参数:${(typeof params === 'string' ? params : JSON.stringify(params)) || ''}`,
|
|
|
`返回结果:${res.request.response}`,
|
|
|
]
|
|
|
arr.forEach((v) => {
|