nah do that instead

This commit is contained in:
Erica Z 2024-11-01 10:22:36 +01:00
parent 66fa21f50f
commit 3923635703

View file

@ -103,12 +103,11 @@ impl Client {
// wrap this logic in a fn so we can use ? // wrap this logic in a fn so we can use ?
async fn perform<T: serde::de::DeserializeOwned + Send + 'static>( async fn perform<T: serde::de::DeserializeOwned + Send + 'static>(
response: Result<reqwest::Response, reqwest::Error>, response: Result<reqwest::Response, reqwest::Error>,
) -> Result<schema::SubsonicResponse<T>, reqwest::Error> { ) -> Result<schema::SubsonicResponseOuter<T>, reqwest::Error> {
Ok(response? response?
.error_for_status()? .error_for_status()?
.json::<schema::SubsonicResponseOuter<T>>() .json::<schema::SubsonicResponseOuter<T>>()
.await? .await
.subsonic_response)
} }
sender sender
@ -120,7 +119,8 @@ impl Client {
let response = receiver let response = receiver
.recv() .recv()
.await .await
.expect("could not receive subsonic response from tokio")?; .expect("could not receive subsonic response from tokio")?
.subsonic_response;
match response { match response {
schema::SubsonicResponse::Ok { inner } => Ok(inner), schema::SubsonicResponse::Ok { inner } => Ok(inner),