fix: app states

This commit is contained in:
DecDuck
2025-07-26 17:57:12 +10:00
parent f92ec38231
commit aad2d964eb
7 changed files with 53 additions and 43 deletions
+5 -3
View File
@@ -1,10 +1,12 @@
use tokio::sync::Mutex;
use crate::AppState;
#[tauri::command]
pub fn fetch_state(
state: tauri::State<'_, std::sync::Mutex<AppState<'_>>>,
pub async fn fetch_state(
state: tauri::State<'_, Mutex<AppState<'_>>>,
) -> Result<String, String> {
let guard = state.lock().unwrap();
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)