| | |
| | | import type { AxiosInstance, AxiosRequestConfig } from 'axios'; |
| | | import type { AxiosInstance, AxiosRequestConfig, CancelToken } from 'axios'; |
| | | import axios from 'axios'; |
| | | import { ElLoadingService, ElMessage } from 'element-plus'; |
| | | import router from '../router'; |
| | |
| | | loading?: boolean; |
| | | noAuth?: boolean; |
| | | handleFail?: boolean; |
| | | cancelToken?: CancelToken | undefined; |
| | | }; |
| | | export const checkAuth = () => { |
| | | const session = Local.get(accessSessionKey); |
| | |
| | | clearAccessTokens(); |
| | | window.location.reload(); |
| | | }); |
| | | window.handleNoAuth = handleNoAuth; |
| | | |
| | | let requestNum = 0; |
| | | let loadingInstance: ReturnType<typeof ElLoadingService>; |
| | | const addLoading = () => { |
| | | // 增加loading 如果pending请求数量等于1,弹出loading, 防止重复弹出 |
| | | // 增加loading 如果pending请求数量等于1,弹出loading, 防止重复弹出F |
| | | requestNum++; |
| | | if (requestNum == 1) { |
| | | loadingInstance = ElLoadingService({ |