Fix favorites commands using wrong state type

Commands were using State<Arc<Mutex<QobuzClient>>> directly instead of
State<AppState>. Changed to use AppState like all other commands.
This commit is contained in:
vicrodh committed 2026-01-09 12:05:20 -06:00
1 parent c7145e889b
commit 7e2740d297
1 file changed
+7 -8
+7 -8
View File
@@ -2,9 +2,8 @@
use serde_json::Value;
use tauri::State;
use tokio::sync::Mutex;
use crate::api::client::QobuzClient;
use crate::AppState;
/// Get user's favorites
/// fav_type can be: "albums", "tracks", or "artists"
@@ -13,11 +12,11 @@ pub async fn get_favorites(
fav_type: String,
limit: Option<u32>,
offset: Option<u32>,
client: State<'_, std::sync::Arc<Mutex<QobuzClient>>>,
state: State<'_, AppState>,
) -> Result<Value, String> {
log::info!("Command: get_favorites type={} limit={:?} offset={:?}", fav_type, limit, offset);
let client = client.lock().await;
let client = state.client.lock().await;
client
.get_favorites(&fav_type, limit.unwrap_or(50), offset.unwrap_or(0))
.await
@@ -30,11 +29,11 @@ pub async fn get_favorites(
pub async fn add_favorite(
fav_type: String,
item_id: String,
client: State<'_, std::sync::Arc<Mutex<QobuzClient>>>,
state: State<'_, AppState>,
) -> Result<(), String> {
log::info!("Command: add_favorite type={} id={}", fav_type, item_id);
let client = client.lock().await;
let client = state.client.lock().await;
client
.add_favorite(&fav_type, &item_id)
.await
@@ -47,11 +46,11 @@ pub async fn add_favorite(
pub async fn remove_favorite(
fav_type: String,
item_id: String,
client: State<'_, std::sync::Arc<Mutex<QobuzClient>>>,
state: State<'_, AppState>,
) -> Result<(), String> {
log::info!("Command: remove_favorite type={} id={}", fav_type, item_id);
let client = client.lock().await;
let client = state.client.lock().await;
client
.remove_favorite(&fav_type, &item_id)
.await