gitlab-org--gitlab-foss/app/assets/javascripts/environments/services/environments_service.js

26 lines
604 B
JavaScript
Raw Normal View History

/* eslint-disable class-methods-use-this */
import Vue from 'vue';
import VueResource from 'vue-resource';
Vue.use(VueResource);
export default class EnvironmentsService {
2017-02-09 06:38:59 -05:00
constructor(endpoint) {
2017-03-28 06:56:24 -04:00
this.environments = Vue.resource(endpoint);
2017-03-29 07:52:17 -04:00
this.folderResults = 3;
2016-10-14 08:14:18 -04:00
}
2016-10-26 11:00:16 -04:00
get(options = {}) {
const { scope, page } = options;
return this.environments.get({ scope, page });
2016-10-14 08:14:18 -04:00
}
postAction(endpoint) {
return Vue.http.post(endpoint, {}, { emulateJSON: true });
}
2017-03-28 06:56:24 -04:00
getFolderContent(folderUrl) {
2017-03-29 07:52:17 -04:00
return Vue.http.get(`${folderUrl}.json?per_page=${this.folderResults}`);
}
}