add initial files

This commit is contained in:
jeffvli
2022-07-25 19:40:16 -07:00
commit e8b612c974
283 changed files with 62820 additions and 0 deletions
@@ -0,0 +1,17 @@
import { Navigate, Outlet, useLocation } from 'react-router-dom';
import { useAuthStore } from 'renderer/store';
interface PrivateOutletProps {
redirectTo: string;
}
export const PrivateOutlet = ({ redirectTo }: PrivateOutletProps) => {
const location = useLocation();
const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
if (isAuthenticated) {
return <Outlet />;
}
return <Navigate replace state={{ from: location }} to={redirectTo} />;
};