aboutsummaryrefslogblamecommitdiffstats
path: root/panel/src/App.jsx
blob: 6699db4bebda0981d3ed3be5a83196e8ff0cd6c6 (plain) (tree)
1
2
3
4
5
6
7
8
9
                          
                                                           






                                                     
                                                               


                                              




                                    
                                                           












                                                                  


                  
                   




                   
import React from 'react';
import { Route, Routes, Navigate } from 'react-router-dom';
import LoginPage from './pages/LoginPage';
import RegisterPage from './pages/RegisterPage';
import ResetPage from './pages/ResetPage';
import Dashboard from './pages/Dashboard';
import ManageAds from './pages/ManageAds';
import Roles from './pages/Roles';
import PrivateRoute from './components/PrivateRoute';
import { AuthProvider, useAuth } from './contexts/AuthContext';
import 'bootstrap/dist/css/bootstrap.min.css';
import './tailwind.css';

const AppRoutes = () => {
  const { currentUser } = useAuth();

  return (
    <Routes>
      <Route path="/" element={<Navigate to="/login" />} />
      <Route path="/login" element={<LoginPage />} />
      <Route path="/register" element={<RegisterPage />} />
      <Route path="/reset" element={<ResetPage />} />
      <Route path="/" element={<PrivateRoute />}>
        <Route path="dashboard" element={<Dashboard />} />
        <Route path="manage-ads" element={<ManageAds />} />
        <Route path="roles" element={<Roles />} />
	<Route path="logout" element={<Navigate to="/login" />} />
      </Route>
    </Routes>
  );
};

function App() {
  return (
    <AuthProvider>
      <AppRoutes />
    </AuthProvider>
  );
}

export default App;