gitlab-org--gitlab-foss/app/assets/javascripts/issue_show/services/index.js

30 lines
663 B
JavaScript
Raw Normal View History

2017-12-14 23:52:18 -05:00
import axios from '../../lib/utils/axios_utils';
2017-04-05 21:13:06 -04:00
export default class Service {
constructor(endpoint) {
2017-12-14 23:52:18 -05:00
this.endpoint = `${endpoint}.json`;
this.realtimeEndpoint = `${endpoint}/realtime_changes`;
2017-04-05 21:13:06 -04:00
}
getData() {
2017-12-14 23:52:18 -05:00
return axios.get(this.realtimeEndpoint);
}
deleteIssuable(payload) {
return axios.delete(this.endpoint, { params: payload });
}
updateIssuable(data) {
2017-12-14 23:52:18 -05:00
return axios.put(this.endpoint, data);
2017-04-05 21:13:06 -04:00
}
// eslint-disable-next-line class-methods-use-this
loadTemplates(templateNamesEndpoint) {
if (!templateNamesEndpoint) {
return Promise.resolve([]);
}
return axios.get(templateNamesEndpoint);
}
2017-04-05 21:13:06 -04:00
}