update
This commit is contained in:
		| @@ -44,7 +44,7 @@ export class QueryLogin { | |||||||
|     this.query = query; |     this.query = query; | ||||||
|   } |   } | ||||||
|   private async init() { |   private async init() { | ||||||
|     await this.cacheStore.init() |     await this.cacheStore.init(); | ||||||
|     this.load = true; |     this.load = true; | ||||||
|     this.onLoad?.(); |     this.onLoad?.(); | ||||||
|   } |   } | ||||||
| @@ -136,6 +136,7 @@ export class QueryLogin { | |||||||
|   } |   } | ||||||
|   /** |   /** | ||||||
|    * 检查401错误,并刷新token, 如果refreshToken存在,则刷新token, 否则返回401 |    * 检查401错误,并刷新token, 如果refreshToken存在,则刷新token, 否则返回401 | ||||||
|  |    * 拦截请求,请使用run401Action, 不要直接使用 afterCheck401ToRefreshToken | ||||||
|    * @param response |    * @param response | ||||||
|    * @param ctx |    * @param ctx | ||||||
|    * @param refetch |    * @param refetch | ||||||
| @@ -176,6 +177,7 @@ export class QueryLogin { | |||||||
|   /** |   /** | ||||||
|    * 一个简单的401处理, 如果401,则刷新token, 如果refreshToken不存在,则返回401 |    * 一个简单的401处理, 如果401,则刷新token, 如果refreshToken不存在,则返回401 | ||||||
|    * refetch 是否重新请求, 会有bug,无限循环,按需要使用 |    * refetch 是否重新请求, 会有bug,无限循环,按需要使用 | ||||||
|  |    * TODO:  | ||||||
|    * @param response |    * @param response | ||||||
|    * @param ctx |    * @param ctx | ||||||
|    * @param opts |    * @param opts | ||||||
| @@ -232,6 +234,9 @@ export class QueryLogin { | |||||||
|           if (config.headers) { |           if (config.headers) { | ||||||
|             config.headers['Authorization'] = `Bearer ${_token}`; |             config.headers['Authorization'] = `Bearer ${_token}`; | ||||||
|           } |           } | ||||||
|  |           if (!_token) { | ||||||
|  |             // TODO: 取消请求,因为没有登陆 | ||||||
|  |           } | ||||||
|           return config; |           return config; | ||||||
|         }, |         }, | ||||||
|         afterResponse: async (response, ctx) => { |         afterResponse: async (response, ctx) => { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user