debian-mirror-gitlab/app/assets/javascripts/issue_show/services/index.js
2021-04-17 20:07:23 +05:30

31 lines
800 B
JavaScript

import { registerCaptchaModalInterceptor } from '~/captcha/captcha_modal_axios_interceptor';
import axios from '../../lib/utils/axios_utils';
export default class Service {
constructor(endpoint) {
this.endpoint = `${endpoint}.json`;
this.realtimeEndpoint = `${endpoint}/realtime_changes`;
registerCaptchaModalInterceptor(axios);
}
getData() {
return axios.get(this.realtimeEndpoint);
}
deleteIssuable(payload) {
return axios.delete(this.endpoint, { params: payload });
}
updateIssuable(data) {
return axios.put(this.endpoint, data);
}
// eslint-disable-next-line class-methods-use-this
loadTemplates(templateNamesEndpoint) {
if (!templateNamesEndpoint) {
return Promise.resolve([]);
}
return axios.get(templateNamesEndpoint);
}
}