import './index.css'; import './i18n'; import React from 'react'; import ReactDOM from 'react-dom/client'; import { createBrowserRouter, Navigate, RouterProvider, } from 'react-router-dom'; import AuthProvider from './components/AuthProvider'; import { ErrorPage } from './error-page'; import { checktoken } from './hooks/useAuth'; import { Audits, Data, Login, Profile, Root, Settings, Vulnerabilities, } from './routes'; import { Add, AuditRoot, Dashboard, Edit, General, Network, Sections, } from './routes/audits'; import { ClientDashboard } from './routes/dashboard'; import { Clients, Collaborators, Companies, CustomData, ImportExport, Templates, } from './routes/data'; import { Register } from './routes/register'; const router = createBrowserRouter([ { path: '/', element: , errorElement: , children: [ { index: true, element: , }, { path: '/audits', element: , }, { path: '/audits/:auditId', element: , children: [ { path: 'general', element: , }, { path: 'network', element: , }, { path: 'findings/add', element: , }, { path: 'dashboard', element: , }, { path: 'findings/:findingId', element: , }, { path: 'sections/:sectionId', element: , }, ], }, { path: '/vulnerabilities', element: , }, { path: '/data', element: , children: [ { index: true, element: , }, { path: '/data/collaborators', element: , }, { path: '/data/companies', element: , }, { path: '/data/clients', element: , }, { path: '/data/templates', element: , }, { path: '/data/customData', element: , }, { path: '/data/importExport', element: , }, ], }, { path: '/settings', element: , }, { path: '/profile', element: , }, { path: '/dashboard', element: , }, ], }, { path: '/login', element: , }, { path: '/register', element: , }, ]); checktoken() .then(result => { ReactDOM.createRoot( document.getElementById('root') ?? document.body, ).render( , ); }) .catch(console.error);