state management refactoring

This commit is contained in:
2026-01-21 20:28:31 +08:00
parent 7f37a3f8c2
commit 8173f10937
18 changed files with 255 additions and 186 deletions

View File

@@ -7,12 +7,12 @@ use crate::{
#[tauri::command]
pub fn get_app_data() -> Result<AppData, String> {
let guard = lock_r!(FDOLL);
Ok(guard.app_data.clone())
Ok(guard.ui.app_data.clone())
}
#[tauri::command]
pub async fn refresh_app_data() -> Result<AppData, String> {
init_app_data().await;
let guard = lock_r!(FDOLL);
Ok(guard.app_data.clone())
Ok(guard.ui.app_data.clone())
}

View File

@@ -51,6 +51,7 @@ pub async fn update_doll(id: String, dto: UpdateDollDto) -> Result<DollDto, Stri
let is_active_doll = {
let guard = lock_r!(FDOLL);
guard
.ui
.app_data
.user
.as_ref()
@@ -82,6 +83,7 @@ pub async fn delete_doll(id: String) -> Result<(), String> {
let is_active_doll = {
let guard = lock_r!(FDOLL);
guard
.ui
.app_data
.user
.as_ref()