From 6e8233e6c1ef9d4192bfab2c22e37dd90f0ccee2 Mon Sep 17 00:00:00 2001 From: Philipp Hoenisch Date: Wed, 2 Dec 2020 15:56:51 +1100 Subject: [PATCH] Get rate from bobtimus --- waves/src/App.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/waves/src/App.tsx b/waves/src/App.tsx index f3686c5a..6b24f705 100644 --- a/waves/src/App.tsx +++ b/waves/src/App.tsx @@ -2,16 +2,27 @@ import React, { useState } from "react"; import "./App.css"; function App() { + const [welcome, setWelcome] = useState("Not welcome yet"); + const [rate, setRate] = useState("No rate received yet"); + import("./wallet-lib/pkg").then(({ hello }) => { let welcome = hello("World"); setWelcome(welcome); }); - const [welcome, setWelcome] = useState("Not welcome yet"); + + fetch("http://localhost:3030/rate") + .then((res) => res.json()) + .then((result) => { + setRate(result); + }).catch((_error) => { + console.log("Could not receive rate from bobtimus"); + }); return (
Rust lib says: `{welcome}`
+
Your exchange rate is: `{rate}`
);