aboutsummaryrefslogtreecommitdiff
path: root/src/api.rs
blob: 4fd3888a2a5e17b49d68e6068506a17efa96610e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::State;
use axum::{Json, extract::State as S};
use std::{collections::HashSet, sync::Arc};
use tokio::sync::RwLock;

pub async fn api_queue_json(S(state): S<Arc<RwLock<State>>>) -> Json<HashSet<String>> {
    Json(state.read().await.queue.clone())
}
pub async fn api_loading_json(S(state): S<Arc<RwLock<State>>>) -> Json<HashSet<String>> {
    Json(state.read().await.loading.clone())
}
pub async fn api_complete_json(S(state): S<Arc<RwLock<State>>>) -> Json<HashSet<String>> {
    Json(state.read().await.complete.clone())
}