1 import axios from "axios";
4 constructor(callback) {
5 this.callback = callback;
7 this.axiosInstance = axios.create({
10 this.submitPdfForm = this.submitPdfForm.bind(this);
11 this.delay = this.delay.bind(this);
12 this.getPdfDownloadLink = this.getPdfDownloadLink.bind(this);
15 submitPdfForm(terms) {
16 const termsValue = [];
17 terms.forEach(term => {
18 termsValue.push({term});
20 const submitFormUrl = '/engine-rest/process-definition/key/sentiment-analysis/submit-form';
24 value: JSON.stringify(termsValue),
30 .post(submitFormUrl, data)
32 const data = response.data;
33 const id = data['id'];
34 this.getPdfDownloadLink(id)
42 return new Promise((resolve, reject) => {
43 setTimeout(resolve, ms);
47 getPdfDownloadLink(id) {
48 const downloadUrl = '/engine-rest/process-instance/' + id + '/variables/reportPDF/data';
52 this.callback(downloadUrl);
57 this.getPdfDownloadLink(id);
63 export default CamundaService;