function getConfig() { apiGet('/config/get') .then(data => { document.getElementById('config-json').value = JSON.stringify(data, null, 2); }) .catch(err => console.error(err)); } function updateConfig() { const config = JSON.parse(document.getElementById('config-json').value); apiPost('/config/update', config) .then(data => showResult('config-result', data)) .catch(err => console.error(err)); }