@calimero-network/mero-react 9.1.2 → 9.1.3
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/index.cjs +16 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -498,7 +498,22 @@ function MeroProvider({
|
|
|
498
498
|
const onError = (err) => {
|
|
499
499
|
if (!active) return;
|
|
500
500
|
setIsOnline(false);
|
|
501
|
-
if (
|
|
501
|
+
if (err instanceof meroJs.AuthRevokedError) {
|
|
502
|
+
logout();
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (err instanceof meroJs.HTTPError && err.status === 403) {
|
|
506
|
+
if (err.headers?.get("x-auth-error") === "permission_denied") {
|
|
507
|
+
console.warn(
|
|
508
|
+
"[MeroProvider] This session cannot open an event stream (403 permission_denied): its token predates the context:subscribe grant. Logging out \u2014 a fresh login mints a key that can subscribe."
|
|
509
|
+
);
|
|
510
|
+
logout();
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
const status = err instanceof meroJs.HTTPError ? err.status : null;
|
|
516
|
+
if (status !== 401 && !err.message.includes("401")) return;
|
|
502
517
|
if (recoveringRef.current) return;
|
|
503
518
|
recoveringRef.current = true;
|
|
504
519
|
void (async () => {
|