@acrool/react-fetcher 0.0.2-alpha.1 → 0.0.2-alpha.2
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.
- package/dist/acrool-react-fetcher.es.js +24 -24
- package/package.json +1 -1
|
@@ -1027,10 +1027,10 @@ const Ct = (e) => {
|
|
|
1027
1027
|
config: e,
|
|
1028
1028
|
request: d
|
|
1029
1029
|
};
|
|
1030
|
-
_t(function(
|
|
1031
|
-
n(
|
|
1032
|
-
}, function(
|
|
1033
|
-
r(
|
|
1030
|
+
_t(function(U) {
|
|
1031
|
+
n(U), p();
|
|
1032
|
+
}, function(U) {
|
|
1033
|
+
r(U), p();
|
|
1034
1034
|
}, O), d = null;
|
|
1035
1035
|
}
|
|
1036
1036
|
"onloadend" in d ? d.onloadend = w : d.onreadystatechange = function() {
|
|
@@ -1212,11 +1212,11 @@ const Er = async (e) => {
|
|
|
1212
1212
|
duplex: "half"
|
|
1213
1213
|
}), v;
|
|
1214
1214
|
if (a.isFormData(r) && (v = O.headers.get("content-type")) && u.setContentType(v), O.body) {
|
|
1215
|
-
const [
|
|
1215
|
+
const [U, $] = Ze(
|
|
1216
1216
|
d,
|
|
1217
1217
|
fe(Ge(h))
|
|
1218
1218
|
);
|
|
1219
|
-
r = et(O.body, tt,
|
|
1219
|
+
r = et(O.body, tt, U, $);
|
|
1220
1220
|
}
|
|
1221
1221
|
}
|
|
1222
1222
|
a.isString(R) || (R = R ? "include" : "omit");
|
|
@@ -1237,12 +1237,12 @@ const Er = async (e) => {
|
|
|
1237
1237
|
["status", "statusText", "headers"].forEach((ie) => {
|
|
1238
1238
|
O[ie] = T[ie];
|
|
1239
1239
|
});
|
|
1240
|
-
const v = a.toFiniteNumber(T.headers.get("content-length")), [
|
|
1240
|
+
const v = a.toFiniteNumber(T.headers.get("content-length")), [U, $] = c && Ze(
|
|
1241
1241
|
v,
|
|
1242
1242
|
fe(Ge(c), !0)
|
|
1243
1243
|
) || [];
|
|
1244
1244
|
T = new Response(
|
|
1245
|
-
et(T.body, tt,
|
|
1245
|
+
et(T.body, tt, U, () => {
|
|
1246
1246
|
$ && $(), p && p();
|
|
1247
1247
|
}),
|
|
1248
1248
|
O
|
|
@@ -1891,7 +1891,7 @@ function Cr() {
|
|
|
1891
1891
|
case _:
|
|
1892
1892
|
var y = f.render;
|
|
1893
1893
|
return f = f.displayName, f || (f = y.displayName || y.name || "", f = f !== "" ? "ForwardRef(" + f + ")" : "ForwardRef"), f;
|
|
1894
|
-
case
|
|
1894
|
+
case U:
|
|
1895
1895
|
return y = f.displayName || null, y !== null ? y : e(f.type) || "Memo";
|
|
1896
1896
|
case $:
|
|
1897
1897
|
y = f._payload, f = f._init;
|
|
@@ -2050,7 +2050,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
2050
2050
|
function R(f) {
|
|
2051
2051
|
typeof f == "object" && f !== null && f.$$typeof === g && f._store && (f._store.validated = 1);
|
|
2052
2052
|
}
|
|
2053
|
-
var E = zt, g = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), T = Symbol.for("react.consumer"), S = Symbol.for("react.context"), _ = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"),
|
|
2053
|
+
var E = zt, g = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), T = Symbol.for("react.consumer"), S = Symbol.for("react.context"), _ = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), U = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), ie = Symbol.for("react.activity"), qt = Symbol.for("react.client.reference"), we = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, qe = Object.prototype.hasOwnProperty, It = Array.isArray, ge = console.createTask ? console.createTask : function() {
|
|
2054
2054
|
return null;
|
|
2055
2055
|
};
|
|
2056
2056
|
E = {
|
|
@@ -2141,7 +2141,7 @@ function Ur(e, ...t) {
|
|
|
2141
2141
|
]).join(";");
|
|
2142
2142
|
oe(e, n, ...t);
|
|
2143
2143
|
}
|
|
2144
|
-
const
|
|
2144
|
+
const j = {
|
|
2145
2145
|
primary: kr,
|
|
2146
2146
|
success: Fr,
|
|
2147
2147
|
info: vr,
|
|
@@ -2185,11 +2185,11 @@ class Q extends Error {
|
|
|
2185
2185
|
const Bt = lt({
|
|
2186
2186
|
lastUpdateTimestamp: 0,
|
|
2187
2187
|
isAuth: !1,
|
|
2188
|
-
getTokens: () => (
|
|
2189
|
-
updateTokens: () =>
|
|
2190
|
-
forceLogout: () =>
|
|
2188
|
+
getTokens: () => (j.warning("AuthStateContext", "getTokens not yet ready"), null),
|
|
2189
|
+
updateTokens: () => j.warning("AuthStateContext", "updateTokens not yet ready"),
|
|
2190
|
+
forceLogout: () => j.warning("AuthStateContext", "forceLogout not yet ready"),
|
|
2191
2191
|
refreshTokens: async () => {
|
|
2192
|
-
|
|
2192
|
+
j.warning("AuthStateContext", "refreshToken not yet ready");
|
|
2193
2193
|
}
|
|
2194
2194
|
}), Lr = () => Jt(Bt), as = ({
|
|
2195
2195
|
children: e,
|
|
@@ -2204,7 +2204,7 @@ const Bt = lt({
|
|
|
2204
2204
|
}, []);
|
|
2205
2205
|
const l = (E) => {
|
|
2206
2206
|
let g;
|
|
2207
|
-
typeof E == "function" ? g = E(t()) : g = E,
|
|
2207
|
+
typeof E == "function" ? g = E(t()) : g = E, j.danger("更新Token", g), n(g), h(ut(g)), i(Date.now());
|
|
2208
2208
|
}, u = () => {
|
|
2209
2209
|
l(null), s && s();
|
|
2210
2210
|
}, R = async () => {
|
|
@@ -2279,7 +2279,7 @@ const qr = lt(M), cs = ({
|
|
|
2279
2279
|
};
|
|
2280
2280
|
}, [o, c, i, h]);
|
|
2281
2281
|
const l = (p) => {
|
|
2282
|
-
|
|
2282
|
+
j.warning("runPendingRequest"), G = !1;
|
|
2283
2283
|
for (const d of Ne)
|
|
2284
2284
|
d(p);
|
|
2285
2285
|
Ne = [];
|
|
@@ -2293,9 +2293,9 @@ const qr = lt(M), cs = ({
|
|
|
2293
2293
|
});
|
|
2294
2294
|
}, R = (p) => new Promise((d, w) => {
|
|
2295
2295
|
var _;
|
|
2296
|
-
|
|
2296
|
+
j.warning("interceptorsRequest"), p.headers["Accept-Language"] = t();
|
|
2297
2297
|
const T = (_ = o()) == null ? void 0 : _.accessToken;
|
|
2298
|
-
if (T && (p.headers.Authorization = `Bearer ${T}`), !(p && s ? s(p) : !1) && G) {
|
|
2298
|
+
if (j.info("setHeader", T), T && (p.headers.Authorization = `Bearer ${T}`), !(p && s ? s(p) : !1) && G) {
|
|
2299
2299
|
u(d, w)(p), w(new Dr({ message: "Token refreshing, so request save queues not send", code: "REFRESH_TOKEN" }));
|
|
2300
2300
|
return;
|
|
2301
2301
|
}
|
|
@@ -2305,14 +2305,14 @@ const qr = lt(M), cs = ({
|
|
|
2305
2305
|
return (w == null ? void 0 : w[p]) || `Error: ${p}`;
|
|
2306
2306
|
}, m = (p) => {
|
|
2307
2307
|
const d = p.response, w = p.config, T = p.status, S = Br(d);
|
|
2308
|
-
|
|
2308
|
+
j.warning("interceptorsResponseError"), n && n(S);
|
|
2309
2309
|
const _ = w && s ? s(w) : !1;
|
|
2310
2310
|
if (d && w && (T === 401 || S.code === "UNAUTHENTICATED")) {
|
|
2311
2311
|
const O = o();
|
|
2312
|
-
return
|
|
2313
|
-
|
|
2314
|
-
})), new Promise((v,
|
|
2315
|
-
u(v,
|
|
2312
|
+
return j.warning("401OrUNAUTHENTICATED", O == null ? void 0 : O.refreshToken), Be(O == null ? void 0 : O.refreshToken) || _ ? (G = !1, h(), Promise.reject(new Q(S))) : (G || (G = !0, j.warning("postRefreshToken"), c().then(() => l(!0)).catch(() => {
|
|
2313
|
+
j.danger("refreshTokens fail"), l(!1);
|
|
2314
|
+
})), new Promise((v, U) => {
|
|
2315
|
+
u(v, U)(w);
|
|
2316
2316
|
}));
|
|
2317
2317
|
}
|
|
2318
2318
|
return Promise.reject(new Q(S));
|