From 2d9d37bd5e4770a05cae780f2113266f3fdd0915 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sat, 15 Oct 2022 09:34:44 -0400 Subject: Add table creation --- webapp/src/main.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'webapp/src') diff --git a/webapp/src/main.rs b/webapp/src/main.rs index 1b60a9f..4ba8e5f 100644 --- a/webapp/src/main.rs +++ b/webapp/src/main.rs @@ -2,6 +2,7 @@ use std::rc::Rc; #[allow(unused_imports)] use log::{debug, error, info, warn}; +use uuid::Uuid; use yew::prelude::*; use yew_router::prelude::*; pub mod bridge_engine; @@ -53,15 +54,24 @@ fn home() -> Html { None => html! {

{ "Log in" }

}, }; + let create_table = Callback::from(|_| { + wasm_bindgen_futures::spawn_local(async move { + let response = Request::post("/api/table").send().await.unwrap(); + let table_id: Uuid = response.json().await.unwrap(); + info!("Created table {table_id}"); + }); + }); + html! { <> if let Some(error) = &ctx.error { } - { user } -

- to={Route::Playground}>{ "Playground" }> -

+ } } -- cgit v1.2.3