change: use PATCH for config update API

This commit is contained in:
Haishan 2018-12-06 00:18:11 +08:00
parent 3584ff6179
commit 8c5ef3e276

View file

@ -11,11 +11,15 @@ export async function fetchConfigs(apiConfig) {
return await fetch(url + endpoint, init); return await fetch(url + endpoint, init);
} }
// TODO support PUT /configs
// req body
// { Path: string }
export async function updateConfigs(apiConfig, o) { export async function updateConfigs(apiConfig, o) {
const { url, init } = getURLAndInit(apiConfig); const { url, init } = getURLAndInit(apiConfig);
return await fetch(url + endpoint, { return await fetch(url + endpoint, {
...init, ...init,
method: 'PUT', method: 'PATCH',
// mode: 'cors', // mode: 'cors',
body: JSON.stringify(o) body: JSON.stringify(o)
}); });