File "update-wp-setting.js"

Full Path: /home/fresvfqn/waterdamagerestorationandrepairsmithtown.com/wp-content/plugins/extendify/src/Agent/workflows/settings/tools/update-wp-setting.js
File size: 411 bytes
MIME-type: text/x-java
Charset: utf-8

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 },
	});
};