aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/components/ProtectedRoute.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/components/ProtectedRoute.tsx')
-rw-r--r--src/client/components/ProtectedRoute.tsx8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/components/ProtectedRoute.tsx b/src/client/components/ProtectedRoute.tsx
index 76b663c..a0eb2ee 100644
--- a/src/client/components/ProtectedRoute.tsx
+++ b/src/client/components/ProtectedRoute.tsx
@@ -1,16 +1,18 @@
+import { useAtomValue } from "jotai";
import type { ReactNode } from "react";
import { Redirect } from "wouter";
-import { useAuth } from "../stores";
+import { authLoadingAtom, isAuthenticatedAtom } from "../atoms";
export interface ProtectedRouteProps {
children: ReactNode;
}
export function ProtectedRoute({ children }: ProtectedRouteProps) {
- const { isAuthenticated, isLoading } = useAuth();
+ const isAuthenticated = useAtomValue(isAuthenticatedAtom);
+ const isLoading = useAtomValue(authLoadingAtom);
if (isLoading) {
- return <div>Loading...</div>;
+ return <output>Loading...</output>;
}
if (!isAuthenticated) {