debian-mirror-gitlab/app/assets/javascripts/issue_show/services/index.js

32 lines
800 B
JavaScript
Raw Normal View History

2021-04-17 20:07:23 +05:30
import { registerCaptchaModalInterceptor } from '~/captcha/captcha_modal_axios_interceptor';
2018-03-17 18:26:18 +05:30
import axios from '../../lib/utils/axios_utils';
2017-09-10 17:25:29 +05:30
2017-08-17 22:00:37 +05:30
export default class Service {
2017-09-10 17:25:29 +05:30
constructor(endpoint) {
2018-03-17 18:26:18 +05:30
this.endpoint = `${endpoint}.json`;
this.realtimeEndpoint = `${endpoint}/realtime_changes`;
2021-04-17 20:07:23 +05:30
registerCaptchaModalInterceptor(axios);
2017-09-10 17:25:29 +05:30
}
getData() {
2018-03-17 18:26:18 +05:30
return axios.get(this.realtimeEndpoint);
2017-09-10 17:25:29 +05:30
}
2019-12-04 20:38:33 +05:30
deleteIssuable(payload) {
return axios.delete(this.endpoint, { params: payload });
2017-08-17 22:00:37 +05:30
}
2017-09-10 17:25:29 +05:30
updateIssuable(data) {
2018-03-17 18:26:18 +05:30
return axios.put(this.endpoint, data);
2017-08-17 22:00:37 +05:30
}
2019-12-21 20:55:43 +05:30
// eslint-disable-next-line class-methods-use-this
loadTemplates(templateNamesEndpoint) {
if (!templateNamesEndpoint) {
return Promise.resolve([]);
}
return axios.get(templateNamesEndpoint);
}
2017-08-17 22:00:37 +05:30
}