Skip to content

Commit

Permalink
Get rate from bobtimus
Browse files Browse the repository at this point in the history
  • Loading branch information
bonomat committed Dec 2, 2020
1 parent 8e549fa commit 6e8233e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion waves/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,27 @@ import React, { useState } from "react";
import "./App.css";

function App() {
const [welcome, setWelcome] = useState<String>("Not welcome yet");
const [rate, setRate] = useState<String>("No rate received yet");

import("./wallet-lib/pkg").then(({ hello }) => {
let welcome = hello("World");
setWelcome(welcome);
});
const [welcome, setWelcome] = useState<String>("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 (
<div className="App">
<header className="App-header">
<div>Rust lib says: `{welcome}`</div>
<div>Your exchange rate is: `{rate}`</div>
</header>
</div>
);
Expand Down

0 comments on commit 6e8233e

Please sign in to comment.