Fix Configuration.cs requiring APIConfiguration (which do not) + Fix menuActions

This commit is contained in:
Eric NGUYEN 2022-10-13 18:36:35 +02:00
parent f5ec81d22b
commit 7a59c23d20
2 changed files with 9 additions and 14 deletions

View file

@ -10,7 +10,14 @@ export function NewEditor(
setEditorState: (newState: IEditorState) => void,
enableLoaded: () => void
): void {
UseLoadOnBoot(enableLoaded, editorState);
if (DISABLE_API) {
enableLoaded();
}
if (editorState.configuration.APIConfiguration !== undefined) {
enableLoaded();
return;
}
// Fetch the configuration from the API
FetchConfiguration()
@ -26,18 +33,6 @@ export function NewEditor(
});
}
function UseLoadOnBoot(enableLoaded: () => void, editorState: IEditorState): void {
useEffect(() => {
if (DISABLE_API) {
enableLoaded();
return;
}
if (editorState.configuration !== undefined) {
enableLoaded();
}
}, []);
}
export function LoadEditor(
files: FileList | null,
setEditorState: Dispatch<SetStateAction<IEditorState>>,