]> git.somenet.org - pub/jan/aic18.git/blob - service-website/src/services/CamundaService.js
Fix getNonEmptyTerms
[pub/jan/aic18.git] / service-website / src / services / CamundaService.js
1 import axios from "axios";
2
3 class CamundaService {
4     constructor() {
5         this.axiosInstance = axios.create({
6             baseURL: 'http://localhost:8085/engine-rest/',
7             headers: {
8                 'Access-Control-Allow-Origin': '*',
9             },
10         });
11         this.submitPdfForm = this.submitPdfForm.bind(this);
12     }
13
14     submitPdfForm(terms) {
15         const termsValue = [];
16         terms.forEach(term => {
17             termsValue.push({term});
18         });
19         console.log('termsValue: ', termsValue);
20         const submitFormUrl = 'process-definition/key/sentiment-analysis/submit-form';
21         const data = {
22             variables: {
23                 terms: {
24                     value: JSON.stringify(termsValue),
25                     type: "Json"
26                 }
27             }
28         };
29         this.axiosInstance
30             .post(submitFormUrl, data)
31             .then(response => {
32                 const data = response.data;
33                 console.log(data);
34             })
35             .catch(error => {
36                 console.log(error);
37             })
38     }
39 }
40
41 export default CamundaService;