aboutsummaryrefslogtreecommitdiffstats
path: root/panel/src/components/PrivateRoute.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'panel/src/components/PrivateRoute.jsx')
-rw-r--r--panel/src/components/PrivateRoute.jsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/panel/src/components/PrivateRoute.jsx b/panel/src/components/PrivateRoute.jsx
new file mode 100644
index 0000000..e2c502d
--- /dev/null
+++ b/panel/src/components/PrivateRoute.jsx
@@ -0,0 +1,11 @@
+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;