aboutsummaryrefslogblamecommitdiffstats
path: root/src/main.jsx
blob: 3de432c93c680b3d4ee6f190ed2d1ea53e50e4c1 (plain) (tree)
1
2
3
4
5
6
7
8
9
                          
                                                                          






                                                                          
                                                
 



                                                               



                                                       















                          
             
           
  
import React from 'react';
import ReactDOM from 'react-dom/client'; // Import from 'react-dom/client'
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import './index.css';
import App from './App';
import Login from './pages/Login';
import Register from './pages/Register';
import Dashboard from './pages/Dashboard';
import ManageAds from './pages/ManageAds';
import PrivateRoute from './utils/PrivateRoute';

const rootElement = document.getElementById('root');
const root = ReactDOM.createRoot(rootElement); // Create a root

root.render(
  <Router>
    <Routes>
      <Route path="/" element={<Login />} />
      <Route path="/register" element={<Register />} />
      <Route
        path="/dashboard"
        element={
          <PrivateRoute>
            <Dashboard />
          </PrivateRoute>
        }
      />
      <Route
        path="/manage-ads"
        element={
          <PrivateRoute>
            <ManageAds />
          </PrivateRoute>
        }
      />
    </Routes>
  </Router>
);