diff options
Diffstat (limited to 'src/ui/handlers/setup.rs')
| -rw-r--r-- | src/ui/handlers/setup.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/ui/handlers/setup.rs b/src/ui/handlers/setup.rs index 5707765..ac91908 100644 --- a/src/ui/handlers/setup.rs +++ b/src/ui/handlers/setup.rs @@ -2,14 +2,15 @@ use axum::{ extract::State, response::{self, IntoResponse, Redirect}, }; +use axum_extra::TypedHeader; +use headers::IfNoneMatch; -use crate::{ - error::Internal, - setup::app::Setup, - ui::assets::{Asset, Assets}, -}; +use crate::{error::Internal, setup::app::Setup, ui::assets::Response}; -pub async fn handler(State(setup): State<Setup>) -> Result<Asset, Error> { +pub async fn handler( + State(setup): State<Setup>, + TypedHeader(if_none_match): TypedHeader<IfNoneMatch>, +) -> Result<Response, Error> { if setup .completed() .await @@ -18,15 +19,12 @@ pub async fn handler(State(setup): State<Setup>) -> Result<Asset, Error> { { Err(Error::SetupCompleted) } else { - Assets::index().map_err(Error::Internal) + Response::index(&if_none_match).map_err(Error::Internal) } } -#[derive(Debug, thiserror::Error)] pub enum Error { - #[error("setup already completed")] SetupCompleted, - #[error("{0}")] Internal(Internal), } |
