From 1177412c87b0efe0e9716a438a470e69f5b93c45 Mon Sep 17 00:00:00 2001 From: spinline Date: Sat, 7 Feb 2026 16:40:55 +0300 Subject: [PATCH] Add user profile and logout button to sidebar footer --- frontend/src/components/layout/sidebar.rs | 37 +++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/layout/sidebar.rs b/frontend/src/components/layout/sidebar.rs index 2b9cfbb..9ce538e 100644 --- a/frontend/src/components/layout/sidebar.rs +++ b/frontend/src/components/layout/sidebar.rs @@ -74,9 +74,21 @@ pub fn Sidebar() -> impl IntoView { } }; + let handle_logout = move |_| { + spawn_local(async move { + let client = gloo_net::http::Request::post("/api/auth/logout"); + if let Ok(resp) = client.send().await { + if resp.ok() { + // Force full reload to clear state + let _ = window().location().set_href("/login"); + } + } + }); + }; + view! {
-
+
- +
+
+
+
+ "A" +
+
+
+
"Admin User"
+
"Online"
+
+ +
+
} }