From cf084242f08a65363995cfda2bfcd4edd50b53f4 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 1 Aug 2022 18:51:00 +0200 Subject: [PATCH] UI: Use only string from api/island/mode --- monkey/monkey_island/cc/ui/src/components/Main.tsx | 2 +- .../monkey_island/cc/ui/src/components/pages/LandingPage.tsx | 2 +- .../cc/ui/src/components/ui-components/IslandResetModal.tsx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/Main.tsx b/monkey/monkey_island/cc/ui/src/components/Main.tsx index d65c71a67..fd36b85a1 100644 --- a/monkey/monkey_island/cc/ui/src/components/Main.tsx +++ b/monkey/monkey_island/cc/ui/src/components/Main.tsx @@ -115,7 +115,7 @@ class AppComponent extends AuthComponent { setMode = () => { return IslandHttpClient.get('/api/island/mode') .then(res => { - this.setState({islandMode: res.body.mode}); + this.setState({islandMode: res.body}); }); } diff --git a/monkey/monkey_island/cc/ui/src/components/pages/LandingPage.tsx b/monkey/monkey_island/cc/ui/src/components/pages/LandingPage.tsx index 3c2bf1037..79d511758 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/LandingPage.tsx +++ b/monkey/monkey_island/cc/ui/src/components/pages/LandingPage.tsx @@ -74,7 +74,7 @@ const LandingPageComponent = (props: Props) => { } function setScenario(scenario: string) { - IslandHttpClient.put('/api/island/mode', {'mode': scenario}) + IslandHttpClient.put('/api/island/mode', scenario) .then(() => { props.onStatusChange(); }); 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 67f3256b4..ac7a8afd6 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 @@ -111,9 +111,9 @@ const IslandResetModal = (props: Props) => { if (res.ok) { return auth.authFetch('/api/propagation-credentials/configured-credentials', {method: 'PUT', body:'[]'}) }}) - .then(res => { + .then(res => { if (res.ok) { - return auth.authFetch('/api/island/mode', {method: 'PUT', body: '{"mode": "unset"}'}) + return auth.authFetch('/api/island/mode', {method: 'PUT', body: '"unset"'}) }}) .then(res => { if (!res.ok) {