Commit 487578c0 authored by Hannah Stepanek's avatar Hannah Stepanek

Add api.group.read to get a group by id

parent b93d503c
...@@ -232,6 +232,7 @@ function api(apiRoutes, auth, store) { ...@@ -232,6 +232,7 @@ function api(apiRoutes, auth, store) {
member: { member: {
delete: apiCall('group.member.delete'), delete: apiCall('group.member.delete'),
}, },
read: apiCall('group.read'),
}, },
groups: { groups: {
list: apiCall('groups.read'), list: apiCall('groups.read'),
......
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
"method": "DELETE", "method": "DELETE",
"desc": "Remove the current user from a group." "desc": "Remove the current user from a group."
} }
},
"read": {
"url": "https://example.com/api/groups/:id",
"method": "GET",
"desc": "Fetch a group."
} }
}, },
"links": { "links": {
......
...@@ -124,6 +124,14 @@ describe('sidebar.services.api', function() { ...@@ -124,6 +124,14 @@ describe('sidebar.services.api', function() {
return api.group.member.delete({ pubid: 'an-id', userid: 'me' }); return api.group.member.delete({ pubid: 'an-id', userid: 'me' });
}); });
it('gets a group by provided group id', () => {
const group = { id: 'group-id', name: 'Group' };
expectCall('get', 'groups/group-id', 200, group);
return api.group.read({ id: 'group-id' }).then(group_ => {
assert.deepEqual(group_, group);
});
});
it('removes internal properties before sending data to the server', () => { it('removes internal properties before sending data to the server', () => {
const annotation = { const annotation = {
$highlight: true, $highlight: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment