Skip to content

Develop #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7,503 changes: 3,740 additions & 3,763 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
"test": "npm run lint && npm run jest"
},
"version": "0.7.11-16",
"version": "0.8.0",
"dependencies": {
"auth0-js": "^6.8.4",
"config": "^3.2.0",
26 changes: 15 additions & 11 deletions src/services/groups.js
Original file line number Diff line number Diff line change
@@ -174,8 +174,8 @@ function mergeGroup(groups, group) {
* @param {Object} group
* @return {String[]} Array of IDs.
*/
export function reduceGroupIds({ id, subGroups }) {
let res = [id];
export function reduceGroupIds({ oldId, subGroups }) {
let res = [oldId];
if (subGroups) {
subGroups.forEach((g) => {
res = res.concat(reduceGroupIds(g));
@@ -212,10 +212,12 @@ class GroupService {
* @param {String} membershipType
* @return {Promise}
*/
addMember(groupId, memberId, membershipType) {
return this.private.api.postJson(`/groups/${groupId}/members`, {
async addMember(groupId, memberId, membershipType) {
const response = await this.private.api.postJson(`/groups/${groupId}/members`, {
param: { memberId, membershipType },
}).then(handleApiResponse);
});

return handleApiResponse(response);
}

/**
@@ -230,12 +232,14 @@ class GroupService {
* whether the response should information about sub-groups, if any.
* @return {Promise} On success resolves to the group data object.
*/
getGroup(groupId, withSubGroups = true) {
async getGroup(groupId, withSubGroups = true) {
let url = `/groups/${groupId}`;
if (withSubGroups) {
url = `${url}/getSubGroups?includeSubGroups=true&oneLevel=false`;
url = `${url}/?includeSubGroups=true&oneLevel=false`;
}
return this.private.api.get(url).then(handleApiResponse);

const response = await this.private.api.get(url);
return handleApiResponse(response);
}

/**
@@ -325,9 +329,9 @@ class GroupService {
* @return {Promise} On sucess resolves to the array of member objects,
* which include user IDs, membership time, and some bookkeeping data.
*/
getMembers(groupId) {
return this.private.api.get(`/groups/${groupId}/members`)
.then(handleApiResponse);
async getMembers(groupId) {
const response = await this.private.api.get(`/groups/${groupId}/members`);
return handleApiResponse(response);
}

/**