|
|
|
@ -33,6 +33,7 @@ if (isDev) {
|
|
|
|
|
}
|
|
|
|
|
window._debugType = debugType;
|
|
|
|
|
export function initAxiosInterceptors(props) {
|
|
|
|
|
initOnlineOfflineListener()
|
|
|
|
|
|
|
|
|
|
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation
|
|
|
|
|
// https://github.com/axios/axios/issues/1497
|
|
|
|
@ -204,3 +205,26 @@ export function initAxiosInterceptors(props) {
|
|
|
|
|
// -----------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function initOnlineOfflineListener() {
|
|
|
|
|
$(window).bind("online", () => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
notification.success({
|
|
|
|
|
duration: null,
|
|
|
|
|
message: '网络恢复正常',
|
|
|
|
|
description:
|
|
|
|
|
'网络恢复正常,感谢使用。',
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
$(window).bind("offline", () => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
|
|
|
|
|
notification.warning({
|
|
|
|
|
duration: null,
|
|
|
|
|
message: '网络异常',
|
|
|
|
|
description:
|
|
|
|
|
'网络异常,请检测网络后重试。',
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|