@@ -101,15 +101,15 @@ export default ({woocommerceUrl, consumerKey, consumerSecret,
101
101
body : JSON . stringify ( params . data ) ,
102
102
} ) . then ( ( { json } ) => ( { data : json } ) ) ,
103
103
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 ) } ) ) ,
113
113
114
114
delete : ( resource , params ) =>
115
115
httpClient ( `${ woocommerceUrl } /wp-json/wc/v3/${ resource } /${ params . id } ` , {
@@ -121,7 +121,6 @@ export default ({woocommerceUrl, consumerKey, consumerSecret,
121
121
params . ids . map ( id =>
122
122
httpClient ( `${ woocommerceUrl } /wp-json/wc/v3/${ resource } /${ id } ` , {
123
123
method : 'DELETE' ,
124
- body : JSON . stringify ( params . data ) ,
125
124
} )
126
125
)
127
126
) . then ( responses => ( { data : responses . map ( ( { json } ) => json . id ) } ) ) ,
0 commit comments