File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
src/apps/wallet-admin/src/lib/services Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -295,14 +295,21 @@ export async function getRecipientViewURL(): Promise<TransactionResponse> {
295
295
}
296
296
297
297
export async function getMemberHandle ( userIds : string [ ] ) : Promise < Map < number , string > > {
298
- const url = `${ memberApiBaseUrl } ?userIds=[${ userIds . join ( ',' ) } ]&fields=handle,userId`
299
- const response = await xhrGetAsync < { handle : string , userId : number } [ ] > ( url )
298
+ const BATCH_SIZE = 50
300
299
301
300
const handleMap = new Map < number , string > ( )
302
301
303
- response . forEach ( member => {
304
- handleMap . set ( member . userId , member . handle )
305
- } )
302
+ for ( let i = 0 ; i < userIds . length ; i += BATCH_SIZE ) {
303
+ const batch = userIds . slice ( i , i + BATCH_SIZE )
304
+
305
+ const url = `${ memberApiBaseUrl } ?userIds=[${ batch . join ( ',' ) } ]&fields=handle,userId`
306
+ // eslint-disable-next-line no-await-in-loop
307
+ const response = await xhrGetAsync < { handle : string , userId : number } [ ] > ( url )
308
+
309
+ response . forEach ( member => {
310
+ handleMap . set ( member . userId , member . handle )
311
+ } )
312
+ }
306
313
307
314
return handleMap
308
315
}
You can’t perform that action at this time.
0 commit comments