From a5231ebe05f612b2d399ef32b36ac8dc92051760 Mon Sep 17 00:00:00 2001 From: angrynode Date: Mon, 23 Feb 2026 16:11:38 +0100 Subject: [PATCH] minor: Rework IndexTemplate constructor --- src/routes/index.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/routes/index.rs b/src/routes/index.rs index 4a3dc6b..af58c9d 100644 --- a/src/routes/index.rs +++ b/src/routes/index.rs @@ -25,18 +25,15 @@ impl FallibleTemplate for IndexTemplate { } impl IndexTemplate { - pub async fn new( - context: AppStateContext, - status: StatusCookie, - ) -> Result, AppStateError> { + pub async fn new(context: AppStateContext) -> Result { let categories = context.db.category().list().await.context(CategorySnafu)?; let children = FileSystemEntry::from_categories(&categories); - Ok(status.with_template(IndexTemplate { + Ok(Self { state: context, flash: None, children, - })) + }) } } @@ -44,5 +41,6 @@ pub async fn index( context: AppStateContext, status: StatusCookie, ) -> Result, AppStateError> { - IndexTemplate::new(context, status).await + let template = IndexTemplate::new(context).await?; + Ok(status.with_template(template)) }