UI: Fix bugs in ImportConfigModal and ImportConfigModal

This commit is contained in:
vakarisz 2022-07-12 15:50:06 +03:00
parent fb1a3bcd74
commit d84382c7ac
2 changed files with 5 additions and 4 deletions

View File

@ -106,7 +106,8 @@ const ConfigImportModal = (props: Props) => {
reader.onload = (event) => {
let importContents = null;
try {
importContents = JSON.parse(event.target.result);
let contents = event.target.result as string;
importContents = JSON.parse(contents);
} catch (e){
setErrorMessage('File is not in a valid json format');
return

View File

@ -106,17 +106,17 @@ const IslandResetModal = (props: Props) => {
.then(res => {
if (res.status === 200) {
return auth.authFetch('/api/clear-simulation-data', {method: 'POST'})
})
}})
.then(res => {
if (res.status === 200) {
return auth.authFetch('/api/island-mode', {method: 'POST', body: '{"mode": "unset"}'})
})
}})
.then(res => {
if (res.status !== 200) {
throw 'Error resetting the simulation'
}
})
}
}
function showModalButtons() {
return (<Container className={`text-left island-reset-modal`}>