diff options
author | Ashelyn Rose <git@ashen.earth> | 2025-02-19 16:05:39 -0700 |
---|---|---|
committer | Ashelyn Rose <git@ashen.earth> | 2025-02-19 16:05:39 -0700 |
commit | 665a4904f89bb842a7ba211abdda62349eac8a03 (patch) | |
tree | 849235c7e531946c1c80c321c23be298c30ffec3 /app/src/lib.rs | |
parent | e8314458ccdf4d3c68969b206cd29f2490fb6308 (diff) |
Simplify calling async from non-async inside oauth controller
Diffstat (limited to 'app/src/lib.rs')
-rw-r--r-- | app/src/lib.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/app/src/lib.rs b/app/src/lib.rs index 8ad149f..9823cdd 100644 --- a/app/src/lib.rs +++ b/app/src/lib.rs @@ -24,7 +24,7 @@ pub fn run() { .plugin(tauri_plugin_opener::init()) .setup(|app| { app.manage(AppState { - oauth_controller: OAuthController::new() + oauth_controller: OAuthController::new(tauri::async_runtime::handle()) }); #[cfg(any(target_os = "linux", all(debug_assertions, windows)))] @@ -52,12 +52,9 @@ pub fn run() { if let Ok(state) = Uuid::try_parse(&state) { let state = state.clone(); let auth_code = auth_code.to_string().clone(); - let app_handle = app_handle.clone(); - let oauth_controller = app_handle.state::<AppState>().oauth_controller.clone(); + let oauth_controller = &app_handle.state::<AppState>().oauth_controller; - tauri::async_runtime::spawn(async move { - oauth_controller.resolve_code(state, auth_code); - }); + oauth_controller.resolve_code(state, auth_code); } else { println!("Invalid UUID format: {state}"); return |