Files
drop-app/src-tauri/src/client/commands.rs
T
2025-07-26 17:57:12 +10:00

14 lines
337 B
Rust

use tokio::sync::Mutex;
use crate::AppState;
#[tauri::command]
pub async fn fetch_state(
state: tauri::State<'_, Mutex<AppState<'_>>>,
) -> Result<String, String> {
let guard = state.lock().await;
let cloned_state = serde_json::to_string(&guard.clone()).map_err(|e| e.to_string())?;
drop(guard);
Ok(cloned_state)
}