blob: a5f9070f0891f84ba52fde61ebbe5b4b775ffc16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
use axum::{
extract::{Request, State},
http::StatusCode,
middleware::Next,
response::{IntoResponse, Response},
};
use crate::{app::App, error::Internal};
pub async fn setup_required(State(app): State<App>, request: Request, next: Next) -> Response {
match app.setup().completed().await {
Ok(true) => next.run(request).await,
Ok(false) => (StatusCode::CONFLICT, "initial setup not completed").into_response(),
Err(error) => Internal::from(error).into_response(),
}
}
|