Shared state
This commit is contained in:
parent
53fff3efaa
commit
15fa09430b
25 changed files with 174 additions and 215 deletions
|
|
@ -1,10 +1,11 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use axum::extract::State;
|
||||
use axum::http::StatusCode;
|
||||
use axum::response::Json;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::state::AppState;
|
||||
use crate::state::SharedState;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct TravelModeInfo {
|
||||
|
|
@ -18,8 +19,9 @@ pub struct TravelModesResponse {
|
|||
}
|
||||
|
||||
pub async fn get_travel_modes(
|
||||
state: Arc<AppState>,
|
||||
State(shared): State<Arc<SharedState>>,
|
||||
) -> Result<Json<TravelModesResponse>, (StatusCode, String)> {
|
||||
let state = shared.load_state();
|
||||
let store = &state.travel_time_store;
|
||||
let modes = store
|
||||
.available_modes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue