Welcome to mirror list, hosted at ThFree Co, Russian Federation.

groups_service.js « service « groups « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 790b581a7c09508186970b67087823a7ec54b59b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import axios from '~/lib/utils/axios_utils';

export default class GroupsService {
  constructor(endpoint) {
    this.endpoint = endpoint;
  }

  getGroups(parentId, page, filterGroups, sort, archived) {
    const params = {};

    if (parentId) {
      params.parent_id = parentId;
    } else {
      // Do not send the following param for sub groups
      if (page) {
        params.page = page;
      }

      if (filterGroups) {
        params.filter = filterGroups;
      }

      if (sort) {
        params.sort = sort;
      }

      if (archived) {
        params.archived = archived;
      }
    }

    return axios.get(this.endpoint, { params });
  }

  // eslint-disable-next-line class-methods-use-this
  leaveGroup(endpoint) {
    return axios.delete(endpoint);
  }
}