aboutsummaryrefslogtreecommitdiff
path: root/src/api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api.rs')
-rw-r--r--src/api.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/api.rs b/src/api.rs
new file mode 100644
index 0000000..4fd3888
--- /dev/null
+++ b/src/api.rs
@@ -0,0 +1,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())
+}