@clownlee/http 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +11 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -172,6 +172,17 @@ async function handleResponseInterceptor(response, store, refreshConfig) {
172
172
  throw new Error(responseData == null ? void 0 : responseData.message);
173
173
  } else if (code === 2001) {
174
174
  const config = response.config;
175
+ if (config._retry) {
176
+ window.parent.postMessage({
177
+ type: "error",
178
+ data: JSON.stringify({
179
+ code: responseData == null ? void 0 : responseData.code,
180
+ message: responseData == null ? void 0 : responseData.message,
181
+ action: "toLogin"
182
+ })
183
+ }, "*");
184
+ throw new Error(responseData == null ? void 0 : responseData.message);
185
+ }
175
186
  if (!refreshConfig || !store) {
176
187
  return response;
177
188
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clownlee/http",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "公共 HTTP 请求库,提供统一的 HTTP 请求能力和自动 token 刷新功能",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",