|
@@ -7,7 +7,7 @@ import { trimData, isNullOrUndefined } from './util-methods'
|
|
|
import router from '@/router'
|
|
|
import i18n from '@/lang'
|
|
|
let currentRequests = 0
|
|
|
-
|
|
|
+let msgDialog = null
|
|
|
export class AxiosWrapper {
|
|
|
constructor({ baseUrl = import.meta.env.VITE_APP_BASE_API, unwrap = true } = {}) {
|
|
|
this.baseUrl = baseUrl
|
|
@@ -49,6 +49,7 @@ export class AxiosWrapper {
|
|
|
return this.$request(uri, data, query, options)
|
|
|
}
|
|
|
async $request(uri, data, query, options) {
|
|
|
+ if (msgDialog) return
|
|
|
if (query && isObject(query)) {
|
|
|
const keys = Object.keys(query)
|
|
|
for (const key of keys) {
|
|
@@ -97,13 +98,16 @@ export class AxiosWrapper {
|
|
|
console.warn(`[${uri}] fail: ${errcode}-${errmsg} ${details}`)
|
|
|
if (errcode != 0) {
|
|
|
if (errcode.includes('401')) {
|
|
|
- ElMessageBox.alert(errmsg, i18n.global.t('common.user_confirm'), {
|
|
|
- confirmButtonText: i18n.global.t('common.re_login'),
|
|
|
- type: 'error',
|
|
|
- callback: (act) => {
|
|
|
- router.replace('/login')
|
|
|
- }
|
|
|
- })
|
|
|
+ if (!msgDialog) {
|
|
|
+ msgDialog = ElMessageBox.alert(errmsg, i18n.global.t('common.user_confirm'), {
|
|
|
+ confirmButtonText: i18n.global.t('common.re_login'),
|
|
|
+ type: 'error',
|
|
|
+ callback: (act) => {
|
|
|
+ router.replace('/login')
|
|
|
+ msgDialog = null;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return returnRes
|