v0.15-WORKINGV4
This commit is contained in:
@@ -327,6 +327,8 @@ 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);
|
||||
//TimeoutFuture::new(1000).await;
|
||||
}
|
||||
@@ -635,39 +637,42 @@ info!("Adding book");
|
||||
time: Some(times),
|
||||
isbn: Some(isbns),
|
||||
};
|
||||
if *app_state.adding.get() == true {
|
||||
app_state.addingrequest.set(true);
|
||||
} else if *app_state.updating.get() == true{
|
||||
|
||||
app_state.apibook.set(record);
|
||||
|
||||
app_state.addingbook.set(BookUI::default());
|
||||
if *app_state.updating.get()==true {
|
||||
app_state.updatingrequest.set(true);
|
||||
}
|
||||
app_state.apibook.set(record);
|
||||
app_state.addingbook.set(BookUI::default());
|
||||
if *app_state.adding.get()==true {
|
||||
app_state.addingrequest.set(true);
|
||||
}
|
||||
app_state.updating.set(false);
|
||||
app_state.adding.set(false);
|
||||
|
||||
//app_state.books.set(vec![BookUI::default()]);
|
||||
|
||||
|
||||
};
|
||||
|
||||
create_effect(cx, || {
|
||||
app_state.apibook.track();
|
||||
let app_state = app_state.clone();
|
||||
let record = (*app_state.apibook.get()).clone();
|
||||
if *app_state.addingrequest.get() == true {
|
||||
spawn_local(async move {
|
||||
info!("Adding effect startedDone");
|
||||
|
||||
if *app_state.addingrequest.get() == true {
|
||||
let temp = add_book(record).await.unwrap();
|
||||
info!("Adding Done{}",temp.status());
|
||||
app_state.refreshing.set(true);
|
||||
app_state.addingrequest.set(false);
|
||||
});
|
||||
} else if *app_state.updatingrequest.get() == true{
|
||||
spawn_local(async move {
|
||||
} else if *app_state.updatingrequest.get() == true {
|
||||
let temp = update_book(record).await.unwrap();
|
||||
info!("Updating Done{}",temp.status());
|
||||
app_state.refreshing.set(true);
|
||||
app_state.updatingrequest.set(false);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
create_effect(cx, || {
|
||||
|
||||
Reference in New Issue
Block a user