summaryrefslogtreecommitdiff
path: root/webapp/src/components/app_context_provider.rs
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2022-11-14 19:49:52 -0500
committerKjetil Orbekk <kj@orbekk.com>2022-11-14 19:49:52 -0500
commit4c0109a8c40012f75e3d0d900c0ef41893cfb4bb (patch)
treee0bf12ffbf5038963f6116250f04f9e820ff8927 /webapp/src/components/app_context_provider.rs
parentd4650a3160d52d289686fb59efbf8f0a436b71eb (diff)
Fetch table state from server
Diffstat (limited to 'webapp/src/components/app_context_provider.rs')
-rw-r--r--webapp/src/components/app_context_provider.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/webapp/src/components/app_context_provider.rs b/webapp/src/components/app_context_provider.rs
index 19e7611..0b490fc 100644
--- a/webapp/src/components/app_context_provider.rs
+++ b/webapp/src/components/app_context_provider.rs
@@ -1,3 +1,4 @@
+use log::error;
use crate::routing::Route;
use gloo_net::http::Request;
use log::info;
@@ -26,13 +27,14 @@ pub struct AppContext {
}
impl AppContext {
- fn spawn_async<F>(&self, f: F)
+ pub fn spawn_async<F>(&self, f: F)
where
F: Future<Output = Result<(), anyhow::Error>> + 'static,
{
let error = self.state.error.clone();
spawn_local(async move {
if let Err(err) = f.await {
+ error!("Error occurred: {err:?}");
error.set(Some(ErrorInfoProperties {
message: format!("Some error occured: {:?}", err),
}));
@@ -47,7 +49,7 @@ impl AppContext {
pub fn error(&self) -> Option<&ErrorInfoProperties> {
self.state.error.as_ref()
}
-
+
pub fn create_table(&self) {
let user = self.state.user.clone();
let history = self.history.clone();