| | |
| | | const RefreshTokenUrl = '/GetTokenByRefreshToken'; |
| | | |
| | | /** 请求白名单,放置一些不需要token的接口(通过设置请求白名单,防止token过期后再请求造成的死循环问题) */ |
| | | const whiteList = [RefreshTokenUrl, '/GetToken']; |
| | | const whiteList = [RefreshTokenUrl, '/passwordLogin']; |
| | | |
| | | let loadingInstance: ReturnType<typeof Loading.service>; |
| | | |
| | |
| | | success: boolean; |
| | | data: any; |
| | | /** |
| | | * http状态吗 |
| | | */ |
| | | code?: number; |
| | | /** |
| | | * 错误码 |
| | | */ |
| | | error?: number; |
| | | errorCode?: string; |
| | | /** |
| | | * 错误信息 |
| | | */ |
| | |
| | | } |
| | | |
| | | interface ErrorInfo { |
| | | errorCode?: number; |
| | | errorCode?: string; |
| | | errorMessage?: string; |
| | | showType?: ErrorShowType; |
| | | data: any; |
| | |
| | | |
| | | // 错误抛出 |
| | | errorThrower: (res) => { |
| | | const { success, data, error: errorCode, msg, showType } = res; |
| | | const { success, data, errorCode, msg, showType } = res; |
| | | if (!success) { |
| | | const error: any = new Error(msg); |
| | | error.name = 'BizError'; |
| | |
| | | |
| | | endLoading(); |
| | | |
| | | return getResponse ? response : (response.data as any).result; |
| | | return getResponse ? response : response.data.data; |
| | | }, |
| | | (error) => { |
| | | endLoading(); |