@@ -1139,16 +1139,41 @@ async function getMembersByHandles(handles) {
1139
1139
* @returns {Object }
1140
1140
*/
1141
1141
async function getStandSkills ( ids ) {
1142
+
1143
+ const queryBatches = [ ] ;
1144
+ const skillIdArg = "&skillId=" ;
1145
+ let queryString = "disablePagination=true" ;
1146
+
1147
+ for ( const id of ids ) {
1148
+ const enid = encodeURIComponent ( id ) ;
1149
+ // When many skill ids, the query string will exceed 2048 limit
1150
+ if ( queryString . length + skillIdArg . length + enid . length < 2048 ) {
1151
+ queryString += skillIdArg + enid ;
1152
+ } else {
1153
+ queryBatches . push ( queryString ) ;
1154
+ queryString = "disablePagination=true" + skillIdArg + enid ;
1155
+ }
1156
+ }
1157
+ queryBatches . push ( queryString ) ;
1158
+
1159
+ const skillDataPromises = [ ] ;
1142
1160
const token = await m2mHelper . getM2MToken ( ) ;
1143
- const res = await axios . get ( `${ config . API_BASE_URL } /v5/standardized-skills/skills` , {
1144
- headers : { Authorization : `Bearer ${ token } ` } ,
1145
- params : {
1146
- page : 1 ,
1147
- perPage : ids . length ,
1148
- skillId : ids ,
1149
- } ,
1150
- } ) ;
1151
- return res . data ;
1161
+ for ( const batch of queryBatches ) {
1162
+ skillDataPromises . push (
1163
+ ( async ( ) => {
1164
+ const res = await axios . get (
1165
+ `${ config . API_BASE_URL } /v5/standardized-skills/skills?${ batch } ` ,
1166
+ {
1167
+ headers : { Authorization : `Bearer ${ token } ` } ,
1168
+ }
1169
+ ) ;
1170
+ return res . data ;
1171
+ } ) ( )
1172
+ ) ;
1173
+ }
1174
+
1175
+ const data = await Promise . all ( skillDataPromises ) ;
1176
+ return _ . concat ( ...data ) ;
1152
1177
}
1153
1178
1154
1179
/**
0 commit comments