Skip to content

Commit

Permalink
lib: server: pages: Remove duplicated code
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Sep 3, 2024
1 parent 8117765 commit f93c4f1
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/lib/server/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,23 +294,8 @@ pub async fn streams_post(json: web::Json<PostStream>) -> HttpResponse {
.body(format!("{error:#?}"));
}

let streams = match stream_manager::streams().await {
Ok(streams) => streams,
Err(error) => {
return HttpResponse::InternalServerError()
.content_type("text/plain")
.body(format!("{error:#?}"))
}
};

match serde_json::to_string_pretty(&streams) {
Ok(json) => HttpResponse::Ok()
.content_type("application/json")
.body(json),
Err(error) => HttpResponse::InternalServerError()
.content_type("text/plain")
.body(format!("{error:#?}")),
}
// Return the new streams available
streams().await
}

#[api_v2_operation]
Expand Down

0 comments on commit f93c4f1

Please sign in to comment.