forked from p15670423/monkey
UI: Use new reset endpoints to reset all data
This commit is contained in:
parent
e8f76f39e1
commit
ddc3f2012d
|
@ -74,8 +74,7 @@ const IslandResetModal = (props: Props) => {
|
|||
<button type='button' className='btn btn-danger btn-lg' style={{margin: '5px'}}
|
||||
onClick={() => {
|
||||
setResetAll(Loading);
|
||||
resetIsland('/api?action=reset',
|
||||
() => {
|
||||
resetAll(() => {
|
||||
setResetAll(Done);
|
||||
props.onClose();
|
||||
})
|
||||
|
@ -98,6 +97,24 @@ const IslandResetModal = (props: Props) => {
|
|||
}
|
||||
})
|
||||
}
|
||||
function resetAll(callback: () => void) {
|
||||
auth.authFetch('/api/reset-agent-configuration', {method: 'POST'})
|
||||
.then(res => {
|
||||
if (res.status === 200) {
|
||||
auth.authFetch('/api/clear-simulation-data', {method: 'POST'})
|
||||
.then(res => {
|
||||
if (res.status === 200) {
|
||||
auth.authFetch('/api/island-mode', {method: 'POST', body: '{"mode": "unset"}'})
|
||||
.then(res => {
|
||||
if (res.status === 200) {
|
||||
callback()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function showModalButtons() {
|
||||
return (<Container className={`text-left island-reset-modal`}>
|
||||
|
|
Loading…
Reference in New Issue