frontend: Only show logout button when logged in

This commit is contained in:
Lennart
2025-11-04 15:33:13 +01:00
parent 53c6e3b1f4
commit 3a10a695f5
7 changed files with 62 additions and 7 deletions

View File

@@ -2,6 +2,8 @@ use askama::Template;
use askama_web::WebTemplate;
use rustical_store::auth::Principal;
use crate::pages::DefaultLayoutData;
pub trait Section: Template {
fn name() -> &'static str;
}
@@ -12,3 +14,9 @@ pub struct UserPage<S: Section> {
pub user: Principal,
pub section: S,
}
impl<S: Section> DefaultLayoutData for UserPage<S> {
fn get_user(&self) -> Option<&Principal> {
Some(&self.user)
}
}