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

index.js « services « issue_show « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 08b04ebfdafc601deed823e3101f98213a1c4cb6 (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
import { registerCaptchaModalInterceptor } from '~/captcha/captcha_modal_axios_interceptor';
import axios from '../../lib/utils/axios_utils';

export default class Service {
  constructor(endpoint) {
    this.endpoint = `${endpoint}.json`;
    this.realtimeEndpoint = `${endpoint}/realtime_changes`;
    registerCaptchaModalInterceptor(axios);
  }

  getData() {
    return axios.get(this.realtimeEndpoint);
  }

  deleteIssuable(payload) {
    return axios.delete(this.endpoint, { params: payload });
  }

  updateIssuable(data) {
    return axios.put(this.endpoint, data);
  }

  // eslint-disable-next-line class-methods-use-this
  loadTemplates(templateNamesEndpoint) {
    if (!templateNamesEndpoint) {
      return Promise.resolve([]);
    }

    return axios.get(templateNamesEndpoint);
  }
}