Shared state
This commit is contained in:
parent
53fff3efaa
commit
15fa09430b
25 changed files with 174 additions and 215 deletions
|
|
@ -1,12 +1,13 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use axum::extract::State;
|
||||
use axum::response::Json;
|
||||
use serde::Serialize;
|
||||
use tracing::info;
|
||||
|
||||
use crate::data::{Histogram, PropertyData};
|
||||
use crate::features::{ENUM_FEATURE_GROUPS, FEATURE_GROUPS};
|
||||
use crate::state::AppState;
|
||||
use crate::state::SharedState;
|
||||
|
||||
fn is_empty(val: &str) -> bool {
|
||||
val.is_empty()
|
||||
|
|
@ -154,7 +155,8 @@ pub fn build_features_response(data: &PropertyData) -> FeaturesResponse {
|
|||
FeaturesResponse { groups }
|
||||
}
|
||||
|
||||
pub async fn get_features(state: Arc<AppState>) -> Json<FeaturesResponse> {
|
||||
pub async fn get_features(State(shared): State<Arc<SharedState>>) -> Json<FeaturesResponse> {
|
||||
let state = shared.load_state();
|
||||
info!("GET /api/features");
|
||||
Json(state.features_response.clone())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue