Better handling of configuration load

This commit is contained in:
Pierre HUBERT 2023-06-17 18:19:11 +02:00
parent cffa8f40c2
commit 56f8dfeb9e
2 changed files with 8 additions and 4 deletions

View File

@ -13,11 +13,10 @@ import "@fontsource/roboto/700.css";
import { BrowserRouter } from "react-router-dom";
import { ConfirmDialogProvider } from "./widgets/ConfirmDialogProvider";
import { AlertDialogProvider } from "./widgets/AlertDialogProvider";
import { AsyncWidget } from "./widgets/AsyncWidget";
async function init() {
try {
await ServerApi.LoadConfig();
const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement
);
@ -28,7 +27,12 @@ async function init() {
<AlertDialogProvider>
<ConfirmDialogProvider>
<div style={{ height: "100vh" }}>
<App />
<AsyncWidget
loadKey={1}
load={async () => await ServerApi.LoadConfig()}
errMsg="Echec de la connexion au serveur pour la récupération de la configuration statique !"
build={() => <App />}
/>
</div>
</ConfirmDialogProvider>
</AlertDialogProvider>

View File

@ -65,7 +65,7 @@ export function AsyncWidget(p: {
<Alert
variant="outlined"
severity="error"
style={{ marginBottom: "15px" }}
style={{ margin: "0px 15px 15px 15px" }}
>
{p.errMsg}
</Alert>