Better handling of configuration load
This commit is contained in:
parent
cffa8f40c2
commit
56f8dfeb9e
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user