diff --git a/app/hoc/withProtectedRoute/index.tsx b/app/hoc/withProtectedRoute/index.tsx index 9c2420c30..1f493342a 100644 --- a/app/hoc/withProtectedRoute/index.tsx +++ b/app/hoc/withProtectedRoute/index.tsx @@ -1,7 +1,7 @@ -import { useEffect, ComponentType } from "react"; +import { useEffect, ComponentType, useState } from "react"; import { useNavigate, useLocation } from "@remix-run/react"; import { useSignals } from "@preact/signals-react/runtime"; -import { LoadingDots } from "~/components"; +import { ConfirmationModal, LoadingDots } from "~/components"; import { authentication } from "~/signals"; import { AUTH_STATUS } from "~/enums"; @@ -9,14 +9,39 @@ export const withProtectionRoute =
(Component: ComponentType
) =>
(rest: P) => {
useSignals();
- const { status } = authentication;
+ const { status, userInfo } = authentication;
+ const [auth, setAuth] = useState("init");
+
+ useEffect(() => {
+ if (auth === "redirect") {
+ window.open("https://storyteller.ai", "_self");
+ }
+ }, [auth]);
//render according to auth status
if (status.value === AUTH_STATUS.LOGGED_OUT) {
return