v0.16-ACTAUL-V0.1
This commit is contained in:
@@ -195,7 +195,7 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
||||
app_state.search.set(task);
|
||||
app_state.openlibrary.set(false);
|
||||
app_state.internalsearch.set(true);
|
||||
app_state.books.set(Vec::new());
|
||||
app_state.refreshing.set(true);
|
||||
info!("Fetching search 2\n");
|
||||
}
|
||||
}
|
||||
@@ -204,6 +204,7 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
||||
let click_listall = |_| {
|
||||
app_state.openlibrary.set(false);
|
||||
app_state.internalsearch.set(false);
|
||||
app_state.refreshing.set(true);
|
||||
|
||||
};
|
||||
|
||||
@@ -229,6 +230,8 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
||||
app_state.search.set(task);
|
||||
app_state.openlibrary.set(false);
|
||||
app_state.internalsearch.set(true);
|
||||
app_state.refreshing.set(true);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -327,14 +330,15 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
|
||||
if *app_state.openlibrary.get() == false {
|
||||
if *app_state.refreshing.get() == true {
|
||||
info!("Refresh triggered");
|
||||
app_state.books.set(Vec::new());
|
||||
app_state.refreshing.set(false);
|
||||
app_state.books.set(Vec::new());
|
||||
//TimeoutFuture::new(1000).await;
|
||||
}
|
||||
//info!("Refresh triggered");
|
||||
|
||||
if *app_state.internalsearch.get() == false {
|
||||
spawn_local(async move {
|
||||
info!("DB triggered");
|
||||
spawn_local(async move {
|
||||
|
||||
let res = list_books(*app_state.pagenum.get())
|
||||
.await.unwrap();
|
||||
app_state.books.set(
|
||||
@@ -345,6 +349,8 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
)
|
||||
});
|
||||
} else {
|
||||
info!("IntSearch triggered");
|
||||
|
||||
spawn_local(async move {
|
||||
let res = search_books(app_state.search.get().to_string(), *app_state.pagenum.get())
|
||||
.await.unwrap();
|
||||
@@ -356,6 +362,8 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if *app_state.refreshing.get() == false {
|
||||
spawn_local(async move {
|
||||
@@ -933,11 +941,14 @@ async fn PageBar<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
|
||||
let handle_add = move |_| {
|
||||
app_state.pagenum.set(*app_state.pagenum.get()+1);
|
||||
app_state.refreshing.set(true);
|
||||
|
||||
};
|
||||
|
||||
let handle_sub = move |_| {
|
||||
if *app_state.pagenum.get()>1 {
|
||||
app_state.pagenum.set(*app_state.pagenum.get()-1);
|
||||
app_state.refreshing.set(true);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -948,6 +959,7 @@ async fn PageBar<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
let pg = currpg.get().as_ref().clone().parse::<u32>().unwrap_or(1);
|
||||
if pg>0 && pg<*app_state.maxpage.get() {
|
||||
app_state.pagenum.set(pg);
|
||||
app_state.refreshing.set(true);
|
||||
} else {
|
||||
currpg.set((*app_state.pagenum.get()).to_string());
|
||||
}
|
||||
@@ -995,7 +1007,7 @@ fn App<G: Html>(cx: Scope) -> View<G> {
|
||||
addingbook: create_rc_signal(BookUI::default()),
|
||||
displaying: create_rc_signal(bool::default()),
|
||||
displayingbook: create_rc_signal(BookUI::default()),
|
||||
refreshing: create_rc_signal(bool::default()),
|
||||
refreshing: create_rc_signal(true),
|
||||
apibook: create_rc_signal(BookUI::default()),
|
||||
updatingrequest: create_rc_signal(bool::default()),
|
||||
addingrequest: create_rc_signal(bool::default()),
|
||||
|
||||
Reference in New Issue
Block a user