| | |
| | | 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({ |
| | | loadingInstance = ElLoadingService({ |
| | | text: '加载中...', |
| | | target: '.layout-parent', |
| | | }); |
| | |
| | | config.headers['hswatersession'] = accessSession; |
| | | } |
| | | if (!noAuth) { |
| | | if (!accessSession ) { |
| | | if (!accessSession) { |
| | | handleNoAuth(); |
| | | } |
| | | } |
| | |
| | | switch (serveData?.err_code) { |
| | | case ErrorCode.Auth: |
| | | handleNoAuth(); |
| | | throw '权限验证失败'; |
| | | throw '权限验证失败'; |
| | | break; |
| | | case ErrorCode.Exception: |
| | | ElMessage.error('内部错误!'); |