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)) }