blob: 737b4793ba30643251bfed45417d2fc23dd6fecb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
use axum::{
extract::{Json, State},
response::{self, IntoResponse},
};
use crate::{app::App, boot::Snapshot, error::Internal, login::Login};
pub async fn handler(State(app): State<App>, login: Login) -> Result<Response, Internal> {
let snapshot = app.boot().snapshot().await?;
Ok(Response { login, snapshot })
}
#[derive(serde::Serialize)]
pub struct Response {
pub login: Login,
#[serde(flatten)]
pub snapshot: Snapshot,
}
impl IntoResponse for Response {
fn into_response(self) -> response::Response {
Json(self).into_response()
}
}
|