summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/issue_show/services/index.js
blob: 0ceff34cf8bf209db58c918185aad7abff3b0743 (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
import Vue from 'vue';
import VueResource from 'vue-resource';

Vue.use(VueResource);

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

    this.resource = Vue.resource(this.endpoint, {}, {
      realtimeChanges: {
        method: 'GET',
        url: `${this.endpoint}/realtime_changes`,
      },
    });
  }

  getData() {
    return this.resource.realtimeChanges();
  }

  deleteIssuable() {
    return this.resource.delete();
  }

  updateIssuable(data) {
    return this.resource.update(data);
  }
}