Move MainMenu Loading to App + Change is/setLoaded to appState/setAppState

This commit is contained in:
Eric NGUYEN 2022-10-18 16:51:44 +02:00
parent b44c6fb477
commit eaf03824fb
10 changed files with 1149 additions and 1138 deletions

View file

@ -1,9 +1,10 @@
import { Dispatch, SetStateAction, useEffect } from 'react';
import { Dispatch, SetStateAction } from 'react';
import { IConfiguration } from '../../../Interfaces/IConfiguration';
import { FetchConfiguration } from '../../API/api';
import { IEditorState } from '../../../Interfaces/IEditorState';
import { LoadState } from './Load';
import { DISABLE_API, GetDefaultEditorState } from '../../../utils/default';
import { AppState } from '../../../Enums/AppState';
export function NewEditor(
editorState: IEditorState,
@ -36,7 +37,7 @@ export function NewEditor(
export function LoadEditor(
files: FileList | null,
setEditorState: Dispatch<SetStateAction<IEditorState>>,
setLoaded: Dispatch<SetStateAction<boolean>>
setAppState: Dispatch<SetStateAction<AppState>>
): void {
if (files === null) {
return;
@ -47,7 +48,7 @@ export function LoadEditor(
const result = reader.result as string;
const editorState: IEditorState = JSON.parse(result);
LoadState(editorState, setEditorState, setLoaded);
LoadState(editorState, setEditorState, setAppState);
});
reader.readAsText(file);
}