UI: Use updated configuration endpoint in ConfigurePage.js

This commit is contained in:
vakarisz 2022-07-07 12:21:22 +03:00
parent c8ed409e9e
commit 30f122dfc3
1 changed files with 4 additions and 6 deletions

View File

@ -19,7 +19,7 @@ import HtmlFieldDescription from '../configuration-components/HtmlFieldDescripti
import CONFIGURATION_TABS_PER_MODE from '../configuration-components/ConfigurationTabs.js'; import CONFIGURATION_TABS_PER_MODE from '../configuration-components/ConfigurationTabs.js';
import {SCHEMA} from '../../services/configuration/config_schema.js'; import {SCHEMA} from '../../services/configuration/config_schema.js';
const CONFIG_URL = '/api/configuration/island'; const CONFIG_URL = '/api/agent-configuration';
export const API_PBA_LINUX = '/api/file-upload/PBAlinux'; export const API_PBA_LINUX = '/api/file-upload/PBAlinux';
export const API_PBA_WINDOWS = '/api/file-upload/PBAwindows'; export const API_PBA_WINDOWS = '/api/file-upload/PBAwindows';
@ -68,10 +68,8 @@ class ConfigurePageComponent extends AuthComponent {
} }
componentDidMount = () => { componentDidMount = () => {
let urls = ['/api/agent-configuration']; this.authFetch(CONFIG_URL).then(res => res.json())
// ??? Why fetch config here and not in `render()`? .then(monkeyConfig => {
Promise.all(urls.map(url => this.authFetch(url).then(res => res.json())))
.then(data => {
let sections = []; let sections = [];
let monkeyConfig = data[0]; let monkeyConfig = data[0];
// TODO: Fix when we add plugins // TODO: Fix when we add plugins
@ -322,7 +320,7 @@ class ConfigurePageComponent extends AuthComponent {
sendConfig() { sendConfig() {
return ( return (
this.authFetch('/api/configuration/island', this.authFetch(CONFIG_URL,
{ {
method: 'POST', method: 'POST',
headers: {'Content-Type': 'application/json'}, headers: {'Content-Type': 'application/json'},