diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/IslandResetModal.tsx b/monkey/monkey_island/cc/ui/src/components/ui-components/IslandResetModal.tsx index b142e97c4..a6eef2070 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/IslandResetModal.tsx +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/IslandResetModal.tsx @@ -74,10 +74,19 @@ const IslandResetModal = (props: Props) => { @@ -97,24 +106,17 @@ const IslandResetModal = (props: Props) => { } }) } - function resetAll(callback: () => void) { - auth.authFetch('/api/reset-agent-configuration', {method: 'POST'}) + function resetAll() { + return 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(); - } - }) - } - }) - } - }) - } + 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"}'}) + }) +} function showModalButtons() { return (