| 1 |
import { allowedSettings } from '@agent/workflows/settings/edit-wp-setting'; |
| 2 |
import apiFetch from '@wordpress/api-fetch'; |
| 3 |
|
| 4 |
export default async ({ settingName, newSettingValue }) => { |
| 5 |
if (!allowedSettings.includes(settingName)) { |
| 6 |
throw new Error('Setting not allowed'); |
| 7 |
} |
| 8 |
return await apiFetch({ |
| 9 |
path: '/wp/v2/settings?context=edit', |
| 10 |
method: 'POST', |
| 11 |
data: { [settingName]: newSettingValue }, |
| 12 |
}); |
| 13 |
}; |
| 14 |
|