Refactoring

This commit is contained in:
KD
2025-03-30 15:40:03 -04:00
parent 88f7df61c0
commit 3a45773a9e
+13 -16
View File
@@ -34,26 +34,23 @@ impl Delete {
.send()
.await
.unwrap();
let mut sng = icarus_models::song::Song::default();
match response.status() {
reqwest::StatusCode::OK => {
println!("Success!");
let s = response.json::<icarus_models::song::Song>().await;
match s {
Ok(parsed) => {
sng = parsed;
}
Err(er) => {
println!("Error {:?}", er);
}
};
}
other => {
panic!("Issue occurred: {:?}", other);
}
}
return Ok(sng);
match response.json::<icarus_models::song::Song>().await {
Ok(sng) => Ok(sng),
Err(er) => Err(std::io::Error::new(
std::io::ErrorKind::Other,
er.to_string(),
)),
}
}
other => Err(std::io::Error::new(
std::io::ErrorKind::Other,
other.to_string(),
)),
}
}
}