From 9c4a407820abb1f4929b415af8844e95acd80a23 Mon Sep 17 00:00:00 2001 From: Wind-Explorer Date: Mon, 8 Dec 2025 19:13:30 +0800 Subject: [PATCH] use wrapper function instead of direct access app handle --- src-tauri/src/state.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs index 8fa5c08..2bd6302 100644 --- a/src-tauri/src/state.rs +++ b/src-tauri/src/state.rs @@ -1,13 +1,12 @@ // in app-core/src/state.rs use crate::{ - lock_w, + get_app_handle, lock_w, models::{ app_config::{AppConfig, AuthConfig}, app_data::AppData, }, remotes::user::UserRemote, services::auth::{load_auth_pass, AuthPass}, - APP_HANDLE, }; use serde_json::json; use std::{ @@ -107,10 +106,7 @@ pub async fn init_app_data() { { let mut guard = lock_w!(FDOLL); guard.app_data.user = Some(user); - APP_HANDLE - .get() - // TODO: magic constants - .expect("App handle not initialized") + get_app_handle() .emit("app-data-refreshed", json!(guard.app_data)) .expect("TODO: handle event emit fail"); }