dauth-context-react 6.6.1 → 6.6.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/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +21 -0
package/dist/index.mjs
CHANGED
|
@@ -2198,6 +2198,18 @@ var DauthProvider = (props) => {
|
|
|
2198
2198
|
autoLoginAction(ctx);
|
|
2199
2199
|
}
|
|
2200
2200
|
}, []);
|
|
2201
|
+
useEffect2(() => {
|
|
2202
|
+
const handleVisibilityChange = () => {
|
|
2203
|
+
if (document.visibilityState === "visible" && !dauthState.isAuthenticated && !dauthState.isLoading) {
|
|
2204
|
+
autoLoginAction(ctx);
|
|
2205
|
+
}
|
|
2206
|
+
};
|
|
2207
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
2208
|
+
return () => document.removeEventListener(
|
|
2209
|
+
"visibilitychange",
|
|
2210
|
+
handleVisibilityChange
|
|
2211
|
+
);
|
|
2212
|
+
}, [ctx, dauthState.isAuthenticated, dauthState.isLoading]);
|
|
2201
2213
|
const loginWithRedirect = useCallback2(() => {
|
|
2202
2214
|
const base = `${getClientBasePath()}/${domainName}/${routes.signin}`;
|
|
2203
2215
|
const url = env ? `${base}?env=${encodeURIComponent(env)}` : base;
|