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 { BrowserRouter } from "react-router-dom";
|
||||||
import { ConfirmDialogProvider } from "./widgets/ConfirmDialogProvider";
|
import { ConfirmDialogProvider } from "./widgets/ConfirmDialogProvider";
|
||||||
import { AlertDialogProvider } from "./widgets/AlertDialogProvider";
|
import { AlertDialogProvider } from "./widgets/AlertDialogProvider";
|
||||||
|
import { AsyncWidget } from "./widgets/AsyncWidget";
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
try {
|
try {
|
||||||
await ServerApi.LoadConfig();
|
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(
|
const root = ReactDOM.createRoot(
|
||||||
document.getElementById("root") as HTMLElement
|
document.getElementById("root") as HTMLElement
|
||||||
);
|
);
|
||||||
@ -28,7 +27,12 @@ async function init() {
|
|||||||
<AlertDialogProvider>
|
<AlertDialogProvider>
|
||||||
<ConfirmDialogProvider>
|
<ConfirmDialogProvider>
|
||||||
<div style={{ height: "100vh" }}>
|
<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>
|
</div>
|
||||||
</ConfirmDialogProvider>
|
</ConfirmDialogProvider>
|
||||||
</AlertDialogProvider>
|
</AlertDialogProvider>
|
||||||
|
@ -65,7 +65,7 @@ export function AsyncWidget(p: {
|
|||||||
<Alert
|
<Alert
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
severity="error"
|
severity="error"
|
||||||
style={{ marginBottom: "15px" }}
|
style={{ margin: "0px 15px 15px 15px" }}
|
||||||
>
|
>
|
||||||
{p.errMsg}
|
{p.errMsg}
|
||||||
</Alert>
|
</Alert>
|
||||||
|
Loading…
Reference in New Issue
Block a user