From bb0953bd942d7953ce5c396658c3fe96ab72c9b4 Mon Sep 17 00:00:00 2001 From: Michael Winsauer Date: Sat, 19 Jan 2019 03:08:03 +0100 Subject: [PATCH] Add demo REST call --- .../src/components/SentimentAnalysis.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/service-website/src/components/SentimentAnalysis.js b/service-website/src/components/SentimentAnalysis.js index d911a62..5e7ba3f 100644 --- a/service-website/src/components/SentimentAnalysis.js +++ b/service-website/src/components/SentimentAnalysis.js @@ -1,6 +1,7 @@ import React, {Component} from "react"; import SearchTermsInput from "./SearchTermsInput"; import {Map} from "immutable"; +import axios from "axios"; class SentimentAnalysis extends Component { constructor(props, context) { @@ -15,6 +16,7 @@ class SentimentAnalysis extends Component { this.handleRemoveTerm = this.handleRemoveTerm.bind(this); this.addEmptyTerm = this.addEmptyTerm.bind(this); this.emptyTerms = this.emptyTerms.bind(this); + this.createPdf = this.createPdf.bind(this); } handleSubmit(event) { @@ -25,6 +27,7 @@ class SentimentAnalysis extends Component { terms.forEach((term) => { console.log(term); }); + this.createPdf(); this.emptyTerms(); } @@ -62,6 +65,22 @@ class SentimentAnalysis extends Component { }); } + createPdf() { + axios + .post('https://jsonplaceholder.typicode.com/posts', { + title: 'foo', + body: 'bar', + userId: 1, + }) + .then(response => { + const data = response.data; + console.log(data); + }) + .catch(error => { + console.log(error); + }); + } + render() { return (
-- 2.43.0