From 6fbbe4975c18642857afbd252ce0f058803a64d5 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 20 Mar 2024 13:26:41 -0400 Subject: [PATCH] refactor: switch to using Authenticated and Navigate components --- app/routes/_index.tsx | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 666f9ca..f8372ce 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -1,24 +1,12 @@ -import {useGo, useIsAuthenticated} from "@refinedev/core"; -import {useEffect} from "react"; +import {Authenticated} from "@refinedev/core"; +import {Navigate} from "@remix-run/react"; export default function Index() { - const {isLoading, data} = useIsAuthenticated(); - - const go = useGo(); - - useEffect(() => { - if (!isLoading) { - if (data?.authenticated) { - go({to: "/dashboard", type: "replace"}); - } else { - go({to: "/login", type: "replace"}); - } - } - }, [isLoading, data]); - - if (isLoading) { - return <>Checking Login Status || null; - } - - return (<>Redirecting) || null; + return ( + Checking Login Status + }> + + + ) }