Skip to content

Commit 05430c3

Browse files
committed
master
1 parent afb77c5 commit 05430c3

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

index.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ export default ({woocommerceUrl, consumerKey, consumerSecret,
101101
body: JSON.stringify(params.data),
102102
}).then(({ json }) => ({ data: json })),
103103

104-
updateMany: (resource, params) => {
105-
const query = {
106-
include: Array(params.ids),
107-
};
108-
return httpClient(`${woocommerceUrl}/wp-json/wc/v3/${resource}?${stringify(query)}`, {
109-
method: 'PUT',
110-
body: JSON.stringify(params.data),
111-
}).then(({ json }) => ({ data: json }));
112-
},
104+
updateMany: (resource, params) =>
105+
Promise.all(
106+
params.ids.map(id =>
107+
httpClient(`${woocommerceUrl}/wp-json/wc/v3/${resource}/${id}`, {
108+
method: 'PUT',
109+
body: JSON.stringify(params.data),
110+
})
111+
)
112+
).then(responses => ({ data: responses.map(({ json }) => json.id) })),
113113

114114
delete: (resource, params) =>
115115
httpClient(`${woocommerceUrl}/wp-json/wc/v3/${resource}/${params.id}`, {
@@ -121,7 +121,6 @@ export default ({woocommerceUrl, consumerKey, consumerSecret,
121121
params.ids.map(id =>
122122
httpClient(`${woocommerceUrl}/wp-json/wc/v3/${resource}/${id}`, {
123123
method: 'DELETE',
124-
body: JSON.stringify(params.data),
125124
})
126125
)
127126
).then(responses => ({ data: responses.map(({ json }) => json.id) })),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ra-data-woocommerce",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"description": "WooCommerce REST API data provider for react-admin",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)