2018-05-14 13:29:21 -04:00
|
|
|
import axios from '~/lib/utils/axios_utils';
|
2016-11-03 17:38:54 -04:00
|
|
|
|
2017-03-13 20:58:26 -04:00
|
|
|
export default class EnvironmentsService {
|
2017-02-09 06:38:59 -05:00
|
|
|
constructor(endpoint) {
|
2018-05-14 13:29:21 -04:00
|
|
|
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
|
|
|
|
2017-05-12 18:02:41 -04:00
|
|
|
get(options = {}) {
|
|
|
|
const { scope, page } = options;
|
2018-05-14 13:29:21 -04:00
|
|
|
return axios.get(this.environmentsEndpoint, { params: { scope, page } });
|
2016-10-14 08:14:18 -04:00
|
|
|
}
|
2016-12-14 01:51:53 -05:00
|
|
|
|
2018-05-14 13:29:21 -04:00
|
|
|
// eslint-disable-next-line class-methods-use-this
|
2017-03-13 20:58:26 -04:00
|
|
|
postAction(endpoint) {
|
2018-05-14 13:29:21 -04:00
|
|
|
return axios.post(endpoint, {}, { emulateJSON: true });
|
2017-03-13 20:58:26 -04:00
|
|
|
}
|
2017-03-27 12:37:26 -04:00
|
|
|
|
2017-03-28 06:56:24 -04:00
|
|
|
getFolderContent(folderUrl) {
|
2018-05-14 13:29:21 -04:00
|
|
|
return axios.get(`${folderUrl}.json?per_page=${this.folderResults}`);
|
2017-03-27 12:37:26 -04:00
|
|
|
}
|
2017-03-13 20:58:26 -04:00
|
|
|
}
|