summaryrefslogtreecommitdiff
path: root/webapp/src
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/src')
-rw-r--r--webapp/src/components/app_context_provider.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/webapp/src/components/app_context_provider.rs b/webapp/src/components/app_context_provider.rs
index 50e4e1a..e3fe82e 100644
--- a/webapp/src/components/app_context_provider.rs
+++ b/webapp/src/components/app_context_provider.rs
@@ -20,7 +20,11 @@ pub struct Props {
}
async fn initialize_context() -> Result<AppContext, anyhow::Error> {
- let user = Request::get("/api/user/info").send().await?.json().await?;
+ let response = Request::get("/api/user/info").send().await?;
+ if response.status() == 401 {
+ web_sys::window().unwrap().location().assign("/api/login").unwrap();
+ };
+ let user = response.json().await?;
Ok(AppContext {
user: user,
error: None,