diff --git a/src/App.tsx b/src/App.tsx index d556ce1..b9797b0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Helmet } from 'react-helmet'; -import { Routes, Route, Navigate } from 'react-router-dom'; +import { Routes, Route, Navigate, Outlet } from 'react-router-dom'; import { Toaster } from 'react-hot-toast'; import { useAuth } from 'src/services/auth'; @@ -10,10 +10,14 @@ import { LoginCallback } from './modules/login/LoginCallback'; // eslint-disable-next-line @typescript-eslint/no-unused-vars function App() { - const { authToken, currentUser } = useAuth(); + const { authToken, currentUser, isAdmin } = useAuth(); const redirectToLogin = !authToken || !currentUser?.app_roles; + const ProtectedRoute = () => { + return isAdmin ? : ; + }; + return ( <> @@ -38,7 +42,9 @@ function App() { } /> - } /> + }> + } /> + } />