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

29 lines
564 B
JavaScript
Raw Normal View History

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
// eslint-disable-next-line class-methods-use-this
2017-05-30 04:12:06 -04:00
leaveGroup(endpoint) {
return Vue.http.delete(endpoint);
}
}