Skip to content

Commit 1cffb7e

Browse files
Make PATCH request for update instead of PUT
When for example not wanting to show or edit a password, a PATCH request would be better, since not all fields should need to be validated on existence.
1 parent 194e4af commit 1cffb7e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export * from './authClient';
1818
* GET_LIST => GET http://my.api.url/posts?filter[sort]="title ASC"&filter[skip]=0&filter[limit]=20
1919
* GET_ONE => GET http://my.api.url/posts/123
2020
* GET_MANY => GET http://my.api.url/posts?filter[where][or]=[{id:123},{id:456}]
21-
* UPDATE => PUT http://my.api.url/posts/123
21+
* UPDATE => PATCH http://my.api.url/posts/123
2222
* CREATE => POST http://my.api.url/posts/123
2323
* DELETE => DELETE http://my.api.url/posts/123
2424
*/
@@ -80,7 +80,7 @@ export default (apiUrl, httpClient = fetchJson) => {
8080
}
8181
case UPDATE:
8282
url = `${apiUrl}/${resource}/${params.id}`;
83-
options.method = 'PUT';
83+
options.method = 'PATCH';
8484
options.body = JSON.stringify(params.data);
8585
break;
8686
case CREATE:

0 commit comments

Comments
 (0)