gitlab-org--gitlab-foss/app/assets/javascripts/groups/services/groups_service.js

30 lines
556 B
JavaScript
Raw Normal View History

2017-05-30 05:26:46 -04:00
/* eslint-disable class-methods-use-this */
import Vue from 'vue';
import VueResource from 'vue-resource';
Vue.use(VueResource);
export default class GroupsService {
constructor(endpoint) {
this.groups = Vue.resource(endpoint);
}
2017-05-30 01:50:29 -04:00
getGroups(parentId, page) {
2017-05-22 13:47:05 -04:00
const data = {};
if (parentId) {
2017-05-22 13:47:05 -04:00
data.parent_id = parentId;
// Do not send this param for sub groups
} else if (page) {
data.page = page;
}
return this.groups.get(data);
}
2017-05-30 04:12:06 -04:00
leaveGroup(endpoint) {
return Vue.http.delete(endpoint);
}
}