Refine Integration #13

Merged
pcfreak30 merged 9 commits from riobuenoDevelops/refine-integration into develop 2024-03-19 23:50:55 +00:00
1 changed files with 12 additions and 17 deletions
Showing only changes of commit 9a8a7ee978 - Show all commits

View File

@ -1,24 +1,19 @@
import {useGo, useIsAuthenticated} from "@refinedev/core"; import { useGo, useIsAuthenticated } from "@refinedev/core";
import {useEffect} from "react";
export default function Index() { export default function Index() {
const {isLoading, data} = useIsAuthenticated(); const { isLoading, data } = useIsAuthenticated();
const go = useGo(); const go = useGo();
useEffect(() => { if (isLoading) {
if (!isLoading) { return <>Checking Login Status</>;
if (data?.authenticated) { }
go({to: "/dashboard", type: "replace"});
} else {
go({to: "/login", type: "replace"});
}
}
}, [isLoading, data]);
if (isLoading) { if (data?.authenticated) {
return <>Checking Login Status</> || null; go({ to: "/dashboard", type: "replace" });
} } else {
go({ to: "/login", type: "replace" });
}
return (<>Redirecting</>) || null; return <>Redirecting</>;
} }