summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_pipelines_index/services/pipelines_service.js
blob: 68b77ff11f7ef7c0fd515a6b0bee94fe4d2cd975 (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
/* eslint-disable class-methods-use-this */
import Vue from 'vue';

export default class PipelinesService {
  constructor(endpoint) {
    this.pipelines = Vue.resource(endpoint);
  }

  getPipelines() {
    return this.pipelines.get();
  }

  /**
   * Post request for all pipelines actions.
   * Endpoint content type needs to be:
   * `Content-Type:application/x-www-form-urlencoded`
   *
   * @param  {String} endpoint
   * @return {Promise}
   */
  postAction(endpoint) {
    return Vue.http.post(endpoint, {}, { emulateJSON: true });
  }
}