use axum::{ extract::{Request, State}, middleware::Next, response::{IntoResponse, Redirect, Response}, }; use crate::{app::App, error::Internal}; pub async fn setup_required(State(app): State, request: Request, next: Next) -> Response { match app.setup().completed().await { Ok(true) => next.run(request).await, Ok(false) => Redirect::to("/setup").into_response(), Err(error) => Internal::from(error).into_response(), } }