]> git.somenet.org - pub/jan/aic18.git/blob - service-website/src/services/CamundaService.js
Add camunda service
[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         terms = [{term: "abc"}, {term: "def"}];
16         const submitFormUrl = 'process-definition/key/sentiment-analysis/submit-form';
17         const data = {
18             variables: {
19                 terms: {
20                     value: JSON.stringify(terms),
21                     type: "Json"
22                 }
23             }
24         };
25         this.axiosInstance
26             .post(submitFormUrl, data)
27             .then(response => {
28                 const data = response.data;
29                 console.log(data);
30             })
31             .catch(error => {
32                 console.log(error);
33             })
34     }
35 }
36
37 export default CamundaService;