HEX
Server: LiteSpeed
System: Linux server318.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: sahadove (2893)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /home/sahadove/wp-content/plugins/extendify/src/Agent/workflows/settings/tools/update-wp-setting.js
import apiFetch from '@wordpress/api-fetch';
import { allowedSettings } from '@agent/workflows/settings/edit-wp-setting';

export default async ({ settingName, newSettingValue }) => {
	if (!allowedSettings.includes(settingName)) {
		throw new Error('Setting not allowed');
	}
	return await apiFetch({
		path: '/wp/v2/settings?context=edit',
		method: 'POST',
		data: { [settingName]: newSettingValue },
	});
};