state management refactoring
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user