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

28 lines
740 B
JavaScript
Raw Normal View History

import axios from '~/lib/utils/axios_utils';
export default class EnvironmentsService {
2017-02-09 06:38:59 -05:00
constructor(endpoint) {
this.environmentsEndpoint = 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
2018-05-17 04:45:43 -04:00
fetchEnvironments(options = {}) {
const { scope, page, nested } = options;
return axios.get(this.environmentsEndpoint, { params: { scope, page, nested } });
2016-10-14 08:14:18 -04:00
}
// eslint-disable-next-line class-methods-use-this
postAction(endpoint) {
return axios.post(endpoint, {});
}
// eslint-disable-next-line class-methods-use-this
deleteAction(endpoint) {
return axios.delete(endpoint, {});
}
getFolderContent(folderUrl, scope) {
return axios.get(`${folderUrl}.json?per_page=${this.folderResults}&scope=${scope}`);
}
}