debian-mirror-gitlab/app/assets/javascripts/environments/services/environments_service.js

28 lines
718 B
JavaScript
Raw Normal View History

2018-11-08 19:23:39 +05:30
import axios from '~/lib/utils/axios_utils';
2017-08-17 22:00:37 +05:30
export default class EnvironmentsService {
constructor(endpoint) {
2018-11-08 19:23:39 +05:30
this.environmentsEndpoint = endpoint;
2017-08-17 22:00:37 +05:30
this.folderResults = 3;
}
2018-11-08 19:23:39 +05:30
fetchEnvironments(options = {}) {
2019-03-02 22:35:43 +05:30
const { scope, page, nested } = options;
return axios.get(this.environmentsEndpoint, { params: { scope, page, nested } });
2017-08-17 22:00:37 +05:30
}
2018-11-08 19:23:39 +05:30
// eslint-disable-next-line class-methods-use-this
2017-08-17 22:00:37 +05:30
postAction(endpoint) {
2018-11-18 11:00:15 +05:30
return axios.post(endpoint, {});
2017-08-17 22:00:37 +05:30
}
2020-04-22 19:07:51 +05:30
// eslint-disable-next-line class-methods-use-this
deleteAction(endpoint) {
return axios.delete(endpoint, {});
}
2017-08-17 22:00:37 +05:30
getFolderContent(folderUrl) {
2018-11-08 19:23:39 +05:30
return axios.get(`${folderUrl}.json?per_page=${this.folderResults}`);
2017-08-17 22:00:37 +05:30
}
}