2017-12-14 23:52:18 -05:00
|
|
|
import axios from '../../lib/utils/axios_utils';
|
2017-05-10 07:29:33 -04:00
|
|
|
|
2017-04-05 21:13:06 -04:00
|
|
|
export default class Service {
|
2017-05-10 07:29:33 -04:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2017-05-10 07:29:33 -04:00
|
|
|
getData() {
|
2017-12-14 23:52:18 -05:00
|
|
|
return axios.get(this.realtimeEndpoint);
|
2017-05-12 06:23:30 -04:00
|
|
|
}
|
|
|
|
|
2019-08-29 00:57:54 -04:00
|
|
|
deleteIssuable(payload) {
|
|
|
|
return axios.delete(this.endpoint, { params: payload });
|
2017-05-12 06:23:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
updateIssuable(data) {
|
2017-12-14 23:52:18 -05:00
|
|
|
return axios.put(this.endpoint, data);
|
2017-04-05 21:13:06 -04:00
|
|
|
}
|
2019-09-18 10:02:45 -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
|
|
|
}
|