diff options
author | Kushal Pandya <kushalspandya@gmail.com> | 2017-10-04 14:10:24 +0000 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-04 22:49:42 +0200 |
commit | de55396134e9e3de429c5c6df55ff06efb8ba329 (patch) | |
tree | 30060acfecfd668c29135d45958af820e7aaa840 /app/assets/javascripts/groups/service | |
parent | 67815272dceb971c03bea3490ec26529b48a52b4 (diff) | |
download | gitlab-ce-de55396134e9e3de429c5c6df55ff06efb8ba329.tar.gz |
Groups tree enhancements for Groups Dashboard and Group Homepage
Diffstat (limited to 'app/assets/javascripts/groups/service')
-rw-r--r-- | app/assets/javascripts/groups/service/groups_service.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/assets/javascripts/groups/service/groups_service.js b/app/assets/javascripts/groups/service/groups_service.js new file mode 100644 index 00000000000..1393c96aed6 --- /dev/null +++ b/app/assets/javascripts/groups/service/groups_service.js @@ -0,0 +1,38 @@ +import Vue from 'vue'; +import VueResource from 'vue-resource'; + +Vue.use(VueResource); + +export default class GroupsService { + constructor(endpoint) { + this.groups = Vue.resource(endpoint); + } + + getGroups(parentId, page, filterGroups, sort) { + const data = {}; + + if (parentId) { + data.parent_id = parentId; + } else { + // Do not send the following param for sub groups + if (page) { + data.page = page; + } + + if (filterGroups) { + data.filter = filterGroups; + } + + if (sort) { + data.sort = sort; + } + } + + return this.groups.get(data); + } + + // eslint-disable-next-line class-methods-use-this + leaveGroup(endpoint) { + return Vue.http.delete(endpoint); + } +} |