UI: Fix bugs in ImportConfigModal and ImportConfigModal
This commit is contained in:
parent
fb1a3bcd74
commit
d84382c7ac
|
@ -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
|
||||
|
|
|
@ -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`}>
|
||||
|
|
Loading…
Reference in New Issue