From 6725b01342c70b3638ffd9296a9394c80091192b Mon Sep 17 00:00:00 2001 From: vakarisz Date: Fri, 8 Jul 2022 10:58:53 +0300 Subject: [PATCH] UI: Adjust config page to use new reset endpoint --- .../cc/ui/src/components/pages/ConfigurePage.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index 1587cc11a..e1016a304 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -21,6 +21,7 @@ import {SCHEMA} from '../../services/configuration/config_schema.js'; import {reformatConfig} from '../configuration-components/ReformatHook'; const CONFIG_URL = '/api/agent-configuration'; +const RESET_URL = '/api/reset-agent-configuration'; export const API_PBA_LINUX = '/api/file-upload/PBAlinux'; export const API_PBA_WINDOWS = '/api/file-upload/PBAwindows'; @@ -145,7 +146,7 @@ class ConfigurePageComponent extends AuthComponent { configSubmit() { return this.sendConfig() .then(res => res.json()) - .then(res => { + .then(() => { this.setState({ lastAction: configSaveAction }); @@ -279,22 +280,16 @@ class ConfigurePageComponent extends AuthComponent { }; resetConfig = () => { - this.authFetch(CONFIG_URL, + this.authFetch(RESET_URL, { method: 'POST', - headers: {'Content-Type': 'application/json'}, - body: JSON.stringify({'reset': true}) }) .then(res => res.json()) - .then(res => { - res.configuration = reformatConfig(res.configuration); + .then(() => { this.setState({ lastAction: 'reset', - schema: res.schema, - configuration: res.configuration, - currentFormData: res.configuration[this.state.selectedSection] }); - this.setInitialConfig(res.configuration); + this.updateConfig(); this.props.onStatusChange(); } ).then(() => {