Skip to content

Commit

Permalink
master
Browse files Browse the repository at this point in the history
  • Loading branch information
zackha committed Sep 6, 2022
1 parent afb77c5 commit 05430c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ export default ({woocommerceUrl, consumerKey, consumerSecret,
body: JSON.stringify(params.data),
}).then(({ json }) => ({ data: json })),

updateMany: (resource, params) => {
const query = {
include: Array(params.ids),
};
return httpClient(`${woocommerceUrl}/wp-json/wc/v3/${resource}?${stringify(query)}`, {
method: 'PUT',
body: JSON.stringify(params.data),
}).then(({ json }) => ({ data: json }));
},
updateMany: (resource, params) =>
Promise.all(
params.ids.map(id =>
httpClient(`${woocommerceUrl}/wp-json/wc/v3/${resource}/${id}`, {
method: 'PUT',
body: JSON.stringify(params.data),
})
)
).then(responses => ({ data: responses.map(({ json }) => json.id) })),

delete: (resource, params) =>
httpClient(`${woocommerceUrl}/wp-json/wc/v3/${resource}/${params.id}`, {
Expand All @@ -121,7 +121,6 @@ export default ({woocommerceUrl, consumerKey, consumerSecret,
params.ids.map(id =>
httpClient(`${woocommerceUrl}/wp-json/wc/v3/${resource}/${id}`, {
method: 'DELETE',
body: JSON.stringify(params.data),
})
)
).then(responses => ({ data: responses.map(({ json }) => json.id) })),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ra-data-woocommerce",
"version": "1.1.3",
"version": "1.1.4",
"description": "WooCommerce REST API data provider for react-admin",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 05430c3

Please sign in to comment.