@@ -174,8 +174,8 @@ function mergeGroup(groups, group) {
174
174
* @param {Object } group
175
175
* @return {String[] } Array of IDs.
176
176
*/
177
- export function reduceGroupIds ( { id , subGroups } ) {
178
- let res = [ id ] ;
177
+ export function reduceGroupIds ( { oldId , subGroups } ) {
178
+ let res = [ oldId ] ;
179
179
if ( subGroups ) {
180
180
subGroups . forEach ( ( g ) => {
181
181
res = res . concat ( reduceGroupIds ( g ) ) ;
@@ -212,10 +212,12 @@ class GroupService {
212
212
* @param {String } membershipType
213
213
* @return {Promise }
214
214
*/
215
- addMember ( groupId , memberId , membershipType ) {
216
- return this . private . api . postJson ( `/groups/${ groupId } /members` , {
215
+ async addMember ( groupId , memberId , membershipType ) {
216
+ const response = await this . private . api . postJson ( `/groups/${ groupId } /members` , {
217
217
param : { memberId, membershipType } ,
218
- } ) . then ( handleApiResponse ) ;
218
+ } ) ;
219
+
220
+ return handleApiResponse ( response ) ;
219
221
}
220
222
221
223
/**
@@ -230,12 +232,14 @@ class GroupService {
230
232
* whether the response should information about sub-groups, if any.
231
233
* @return {Promise } On success resolves to the group data object.
232
234
*/
233
- getGroup ( groupId , withSubGroups = true ) {
235
+ async getGroup ( groupId , withSubGroups = true ) {
234
236
let url = `/groups/${ groupId } ` ;
235
237
if ( withSubGroups ) {
236
- url = `${ url } /getSubGroups ?includeSubGroups=true&oneLevel=false` ;
238
+ url = `${ url } /?includeSubGroups=true&oneLevel=false` ;
237
239
}
238
- return this . private . api . get ( url ) . then ( handleApiResponse ) ;
240
+
241
+ const response = await this . private . api . get ( url )
242
+ return handleApiResponse ( response ) ;
239
243
}
240
244
241
245
/**
@@ -325,9 +329,9 @@ class GroupService {
325
329
* @return {Promise } On sucess resolves to the array of member objects,
326
330
* which include user IDs, membership time, and some bookkeeping data.
327
331
*/
328
- getMembers ( groupId ) {
329
- return this . private . api . get ( `/groups/${ groupId } /members` )
330
- . then ( handleApiResponse ) ;
332
+ async getMembers ( groupId ) {
333
+ const response = await this . private . api . get ( `/groups/${ groupId } /members` ) ;
334
+ return handleApiResponse ( response ) ;
331
335
}
332
336
333
337
/**
0 commit comments