aboutsummaryrefslogtreecommitdiffstats
path: root/panel/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'panel/src/components')
-rw-r--r--panel/src/components/PrivateRoute.jsx10
1 files changed, 10 insertions, 0 deletions
diff --git a/panel/src/components/PrivateRoute.jsx b/panel/src/components/PrivateRoute.jsx
new file mode 100644
index 0000000..04e00f7
--- /dev/null
+++ b/panel/src/components/PrivateRoute.jsx
@@ -0,0 +1,10 @@
+import React from 'react';
+import { Navigate, Outlet } from 'react-router-dom';
+import { useAuth } from '../contexts/AuthContext';
+
+const PrivateRoute = () => {
+ const { currentUser } = useAuth();
+ return currentUser ? <Outlet /> : <Navigate to="/login" />;
+};
+
+export default PrivateRoute;