GeneIT/geneit_app/src/index.tsx

50 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-06-06 13:47:30 +00:00
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import { App } from "./App";
2023-06-06 13:47:30 +00:00
import reportWebVitals from "./reportWebVitals";
import { ServerApi } from "./api/ServerApi";
2023-06-06 08:52:50 +00:00
2023-06-06 14:39:47 +00:00
// Roboto font
import "@fontsource/roboto/300.css";
import "@fontsource/roboto/400.css";
import "@fontsource/roboto/500.css";
import "@fontsource/roboto/700.css";
import { BrowserRouter } from "react-router-dom";
2023-06-14 14:12:09 +00:00
import { ConfirmDialogProvider } from "./widgets/ConfirmDialogProvider";
import { AlertDialogProvider } from "./widgets/AlertDialogProvider";
2023-06-06 14:39:47 +00:00
2023-06-06 13:47:30 +00:00
async function init() {
try {
await ServerApi.LoadConfig();
const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement
);
root.render(
<React.StrictMode>
2023-06-06 14:39:47 +00:00
<BrowserRouter>
2023-06-14 14:12:09 +00:00
<AlertDialogProvider>
<ConfirmDialogProvider>
<div style={{ height: "100vh" }}>
<App />
</div>
</ConfirmDialogProvider>
</AlertDialogProvider>
2023-06-06 14:39:47 +00:00
</BrowserRouter>
2023-06-06 13:47:30 +00:00
</React.StrictMode>
);
} catch (e) {
console.error(e);
alert("Echec de l'initialisation de l'application !");
}
}
init();
2023-06-06 08:52:50 +00:00
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();