|
|
|
|
@ -41,7 +41,7 @@ service.interceptors.request.use(
|
|
|
|
|
// do something with request error
|
|
|
|
|
console.log(error) // for debug
|
|
|
|
|
Vue.prototype.$nextTick().then(r => loadingInstance?.close())
|
|
|
|
|
parent?._addError(error, 'axios-request', error.config.params||error.config.data)
|
|
|
|
|
top?._addError(error, 'axios-request', error.config.params||error.config.data)
|
|
|
|
|
return Promise.reject(error)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
@ -87,11 +87,13 @@ service.interceptors.response.use(
|
|
|
|
|
location.reload()
|
|
|
|
|
})
|
|
|
|
|
if (window._IN_IFRAME) {
|
|
|
|
|
parent?._logout()
|
|
|
|
|
top?._logout()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
parent?._addError(res.msg, `axios-response ${response.config.url}`, response.config.params || response.config.data)
|
|
|
|
|
if (top) {
|
|
|
|
|
top._addError(res.msg, `axios-response ${response.config?.url}`, response.config?.params || response.config?.data)
|
|
|
|
|
}
|
|
|
|
|
return Promise.reject(new Error(res.msg || 'Error'))
|
|
|
|
|
} else {
|
|
|
|
|
return res.data
|
|
|
|
|
@ -105,7 +107,9 @@ service.interceptors.response.use(
|
|
|
|
|
type: 'error',
|
|
|
|
|
duration: 5 * 1000
|
|
|
|
|
})
|
|
|
|
|
parent?._addError(error.toString(), `axios-request ${error.config.url}`, error.config.params || error.config.data)
|
|
|
|
|
if (top) {
|
|
|
|
|
top._addError(error.toString(), `axios-request ${error.config.url}`, error.config.params || error.config.data)
|
|
|
|
|
}
|
|
|
|
|
return Promise.reject(error)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|