2022-10-31 15:09:21 -04:00
|
|
|
// @ts-ignore
|
2022-10-31 16:03:14 -04:00
|
|
|
import { Content } from '@carbon/react';
|
2022-10-12 10:21:49 -04:00
|
|
|
|
|
|
|
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
2022-11-15 14:40:35 -05:00
|
|
|
import { defineAbility } from '@casl/ability';
|
2022-10-12 10:21:49 -04:00
|
|
|
import NavigationBar from './components/NavigationBar';
|
|
|
|
|
2022-11-10 17:30:27 -05:00
|
|
|
import HomePageRoutes from './routes/HomePageRoutes';
|
2022-10-12 10:21:49 -04:00
|
|
|
import ErrorBoundary from './components/ErrorBoundary';
|
|
|
|
import AdminRoutes from './routes/AdminRoutes';
|
|
|
|
|
2022-11-15 14:40:35 -05:00
|
|
|
import { AbilityContext } from './contexts/Can';
|
2022-12-14 12:23:49 -05:00
|
|
|
import UserService from './services/UserService';
|
2022-12-30 15:05:22 -05:00
|
|
|
import ErrorDisplay from './components/ErrorDisplay';
|
2023-01-25 10:46:56 -05:00
|
|
|
import APIErrorProvider from './contexts/APIErrorContext';
|
2022-11-15 14:40:35 -05:00
|
|
|
|
2022-10-12 10:21:49 -04:00
|
|
|
export default function App() {
|
2022-12-14 12:23:49 -05:00
|
|
|
if (!UserService.isLoggedIn()) {
|
|
|
|
UserService.doLogin();
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-11-15 17:35:16 -05:00
|
|
|
const ability = defineAbility(() => {});
|
2022-11-15 14:40:35 -05:00
|
|
|
|
2022-10-12 10:21:49 -04:00
|
|
|
return (
|
2022-11-07 10:10:47 -05:00
|
|
|
<div className="cds--white">
|
2022-11-15 14:40:35 -05:00
|
|
|
{/* @ts-ignore */}
|
|
|
|
<AbilityContext.Provider value={ability}>
|
2023-01-25 10:46:56 -05:00
|
|
|
<APIErrorProvider>
|
2022-11-15 14:40:35 -05:00
|
|
|
<BrowserRouter>
|
|
|
|
<NavigationBar />
|
|
|
|
<Content>
|
2022-12-30 15:05:22 -05:00
|
|
|
<ErrorDisplay />
|
2022-11-15 14:40:35 -05:00
|
|
|
<ErrorBoundary>
|
|
|
|
<Routes>
|
2022-11-16 12:57:17 -05:00
|
|
|
<Route path="/*" element={<HomePageRoutes />} />
|
2022-11-15 14:40:35 -05:00
|
|
|
<Route path="/tasks/*" element={<HomePageRoutes />} />
|
|
|
|
<Route path="/admin/*" element={<AdminRoutes />} />
|
|
|
|
</Routes>
|
|
|
|
</ErrorBoundary>
|
|
|
|
</Content>
|
|
|
|
</BrowserRouter>
|
2023-01-25 10:46:56 -05:00
|
|
|
</APIErrorProvider>
|
2022-11-15 14:40:35 -05:00
|
|
|
</AbilityContext.Provider>
|
2022-11-07 10:10:47 -05:00
|
|
|
</div>
|
2022-10-12 10:21:49 -04:00
|
|
|
);
|
|
|
|
}
|