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) => {
|
reader.onload = (event) => {
|
||||||
let importContents = null;
|
let importContents = null;
|
||||||
try {
|
try {
|
||||||
importContents = JSON.parse(event.target.result);
|
let contents = event.target.result as string;
|
||||||
|
importContents = JSON.parse(contents);
|
||||||
} catch (e){
|
} catch (e){
|
||||||
setErrorMessage('File is not in a valid json format');
|
setErrorMessage('File is not in a valid json format');
|
||||||
return
|
return
|
||||||
|
|
|
@ -106,17 +106,17 @@ const IslandResetModal = (props: Props) => {
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
return auth.authFetch('/api/clear-simulation-data', {method: 'POST'})
|
return auth.authFetch('/api/clear-simulation-data', {method: 'POST'})
|
||||||
})
|
}})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
return auth.authFetch('/api/island-mode', {method: 'POST', body: '{"mode": "unset"}'})
|
return auth.authFetch('/api/island-mode', {method: 'POST', body: '{"mode": "unset"}'})
|
||||||
})
|
}})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
throw 'Error resetting the simulation'
|
throw 'Error resetting the simulation'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function showModalButtons() {
|
function showModalButtons() {
|
||||||
return (<Container className={`text-left island-reset-modal`}>
|
return (<Container className={`text-left island-reset-modal`}>
|
||||||
|
|
Loading…
Reference in New Issue