Files
booksman/frontend/src/main.rs
2022-08-31 11:40:50 +05:30

62 lines
1.5 KiB
Rust

use gloo_net::http::Request;
use wasm_bindgen_futures::spawn_local;
use sycamore::prelude::*;
use sycamore::suspense::Suspense;
use sycamore_router::{Route, Router, RouterProps};
use log::Level;
#[derive(Route)]
enum AppRoutes {
#[to("/")]
Home,
#[to("/hello-server")]
HelloServer,
#[not_found]
NotFound,
}
#[component]
fn App<G: Html>(cx: Scope) -> View<G> {
view! {cx,
div{"Test"}
/*
Router {
integration: {HistoryIntegration::new()},
view: |cx, route: &ReadSignal<AppRoutes>| {
view! {
div(class="app") {
(match route.get().as_ref() {
AppRoutes::Home => view! { cx,
"This is the index page"
},
AppRoutes::HelloServer => view! { cx,
"About this website"
},
AppRoutes::NotFound => view! { cx,
"404 Not Found"
},
})
}
}
}
}
*/
}
}
#[component(HelloServer<G>)]
fn HelloServer<G: Html>(cx: Scope) -> View<G> {
view! {cx,
div{"No server response"}
}
}
fn main() {
console_error_panic_hook::set_once();
console_log::init_with_level(log::Level::Debug).unwrap();
sycamore::render(|cx| view! { cx, App {} });
//sycamore::render(|cx| App(cx));
}