mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2026-07-14 06:46:34 +10:00
fix: app states
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user