Refactoring
This commit is contained in:
+13
-16
@@ -34,26 +34,23 @@ impl Delete {
|
|||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut sng = icarus_models::song::Song::default();
|
|
||||||
|
|
||||||
match response.status() {
|
match response.status() {
|
||||||
reqwest::StatusCode::OK => {
|
reqwest::StatusCode::OK => {
|
||||||
println!("Success!");
|
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(),
|
||||||
|
)),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user