From 946036077cb724db1840e47ffa8b0e1d3dacbc27 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Tue, 5 Oct 2021 18:34:42 +0200 Subject: [PATCH] fix: Miscellaneous improvements --- lib/pushToMongo.js | 8 ++++++++ pages/index.js | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 lib/pushToMongo.js diff --git a/lib/pushToMongo.js b/lib/pushToMongo.js new file mode 100644 index 0000000..6ef2acc --- /dev/null +++ b/lib/pushToMongo.js @@ -0,0 +1,8 @@ +import axios from "axios" + +export async function pushToMongo(data){ + let response = await axios.post('http://metaforecast-twitter-bot.herokuapp.com/utility-function-extractor', { + data: data + }) + console.log(response) +} \ No newline at end of file diff --git a/pages/index.js b/pages/index.js index 2619b55..e9b4778 100644 --- a/pages/index.js +++ b/pages/index.js @@ -8,6 +8,7 @@ import { DisplayElement } from '../lib/displayElement' import { DisplayAsMarkdown } from '../lib/displayAsMarkdown' import { CreateTableWithDistances } from '../lib/findPaths' import { TextAreaForJson } from "../lib/textAreaForJson" +import { pushToMongo } from "../lib/pushToMongo" let increasingList = (n) => Array.from(Array(n).keys()) let buildLinks = quantitativeComparisons => quantitativeComparisons.map(([element1, element2, distance]) => ({ source: element1, target: element2, distance: distance })) @@ -223,6 +224,7 @@ export default function Home({ listOfElementsDefault }) { setSliderValue(0) if (successStatus) { let jsObject = nicelyFormatLinks(quantitativeComparisons, listOfElements) + pushToMongo(jsObject) console.log(jsObject) } }