Skip to content

Commit dfc7a91

Browse files
authored
Merge pull request #88 from topcoder-platform/v5-groups-api
V5 groups api
2 parents 99adfb0 + b5f2f52 commit dfc7a91

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
3232
"test": "npm run lint && npm run jest"
3333
},
34-
"version": "0.7.11-14",
34+
"version": "0.7.11-15",
3535
"dependencies": {
3636
"auth0-js": "^6.8.4",
3737
"config": "^3.2.0",

src/services/groups.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ export function checkUserGroups(groupIds, userGroups, knownGroups) {
139139
*/
140140
function handleApiResponse(response) {
141141
if (!response.ok) throw new Error(response.statusText);
142-
return response.json().then(({ result }) => {
143-
if (result.status !== 200) throw new Error(result.content);
144-
return result.content;
145-
});
142+
return response.json();
143+
// return response.json().then(({ result }) => {
144+
// return result;
145+
// if (result.status !== 200) throw new Error(result.content);
146+
// });
146147
}
147148

148149
/**
@@ -193,7 +194,7 @@ class GroupService {
193194
constructor(tokenV3) {
194195
const now = Date.now();
195196
this.private = {
196-
api: getApi('V3', tokenV3),
197+
api: getApi('V5', tokenV3),
197198
cache: {
198199
groupTreeIds: {
199200
lastCleanUp: now,
@@ -341,9 +342,9 @@ class GroupService {
341342
if (withSubGroups) url += '?includeSubGroups=true';
342343
let res = await this.private.api.get(url);
343344
if (!res.ok) throw new Error(res.statusText);
344-
res = (await res.json()).result;
345-
if (!res.success) throw new Error(res.content);
346-
return Number(res.content);
345+
res = (await res.json());
346+
// if (!res.success) throw new Error(res.content);
347+
return Number(res.count);
347348
}
348349

349350
/**

0 commit comments

Comments
 (0)