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

@ -32,7 +32,7 @@ namespace SVGLDLibs.Models
[DataMember(EmitDefaultValue = false, IsRequired = true)] [DataMember(EmitDefaultValue = false, IsRequired = true)]
public AvailableContainerModel MainContainer { get; set; } public AvailableContainerModel MainContainer { get; set; }
[DataMember(EmitDefaultValue = false, IsRequired = true)] [DataMember(EmitDefaultValue = false)]
public APIConfiguration APIConfiguration { get; set; } public APIConfiguration APIConfiguration { get; set; }
} }
} }

View file

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