1 import axios from "axios";
4 constructor(callback) {
5 this.callback = callback;
6 this.baseUrl = 'http://localhost:8085/engine-rest/';
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);
13 this.completeTask = this.completeTask.bind(this);
16 submitPdfForm(terms) {
17 const termsValue = [];
18 terms.forEach(term => {
19 termsValue.push({term});
21 console.log('termsValue: ', termsValue);
22 const submitFormUrl = 'process-definition/key/sentiment-analysis/submit-form';
26 value: JSON.stringify(termsValue),
32 .post(submitFormUrl, data)
34 const data = response.data;
36 const id = data['id'];
37 this.getPdfDownloadLink(id)
45 return new Promise((resolve, reject) => {
46 setTimeout(resolve, ms);
50 getPdfDownloadLink(id) {
51 const downloadUrl = this.baseUrl + 'process-instance/' + id + '/variables/reportPDF/data';
52 console.log('download: ' + downloadUrl);
57 this.callback(downloadUrl);
62 this.getPdfDownloadLink(id);
68 const completeTaskUrl = 'task/' + id + '/complete';
70 .post(completeTaskUrl)
72 const data = response.data;
81 export default CamundaService;