UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

20 lines (19 loc) 1.11 kB
import { jsx as o, Fragment as m } from "react/jsx-runtime"; import { BlockingLoader as r } from "../../../components/LoadingScreen/LoadingScreen.js"; import { useState as u, useEffect as c } from "react"; import "../../context/FullContextProvider.js"; import { useSynapseContext as f } from "../../context/SynapseContext.js"; import "../../context/DocumentMetadataContext.js"; import { storeRedirectURLForOneSageLoginAndGotoURL as h } from "../AppUtils.js"; import { useOneSageURL as p } from "../../hooks/useOneSageURL.js"; import { useApplicationSessionContext as g } from "./ApplicationSessionContext.js"; function U({ children: s }) { const { isAuthenticated: t } = f(), { hasInitializedSession: i } = g(), n = p(), [e, a] = u(!1); return c(() => { i && !e && (a(!0), t || h(n.toString())); }, [i, t, e, n]), e ? t ? /* @__PURE__ */ o(m, { children: s }) : /* @__PURE__ */ o(r, { show: !0, hintText: "Redirecting to sign in..." }) : /* @__PURE__ */ o(r, { show: !0, hintText: "Checking authentication..." }); } export { U as AuthenticationGuard }; //# sourceMappingURL=AuthenticationGuard.js.map