v0.05
This commit is contained in:
@@ -116,6 +116,7 @@ async fn VisitsCount<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
// app_state.books.get().num_found
|
||||
//);
|
||||
let app_state = app_state.clone();
|
||||
app_state.search.track();
|
||||
spawn_local(async move {
|
||||
app_state.books.set(
|
||||
fetch_books(app_state.search.get().to_string())
|
||||
@@ -127,12 +128,12 @@ async fn VisitsCount<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
|
||||
// let lbooks = fetch_books("lord of the rings".to_string()).await.unwrap();
|
||||
view! {cx,
|
||||
p {
|
||||
"Total visits: "
|
||||
span {
|
||||
//(search)
|
||||
(app_state.books.get().num_found)
|
||||
}
|
||||
p {
|
||||
(if !app_state.search.get().is_empty() {
|
||||
view!{cx,span {(app_state.books.get().num_found)} }
|
||||
}else {
|
||||
view! { cx, span { "World" } }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,28 +154,6 @@ fn App<G: Html>(cx: Scope) -> View<G> {
|
||||
VisitsCount {}
|
||||
}
|
||||
}
|
||||
/*
|
||||
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"
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user