dashboard: error_response takes &str
This commit is contained in:
parent
c82d41728c
commit
46ff9c7aee
2 changed files with 11 additions and 4 deletions
|
|
@ -67,23 +67,23 @@ async fn post_approve(
|
|||
) -> Response {
|
||||
match actions::approve(&state.coord, id).await {
|
||||
Ok(()) => Redirect::to("/").into_response(),
|
||||
Err(e) => error_response(format!("approve {id} failed: {e:#}")),
|
||||
Err(e) => error_response(&format!("approve {id} failed: {e:#}")),
|
||||
}
|
||||
}
|
||||
|
||||
async fn post_deny(State(state): State<AppState>, AxumPath(id): AxumPath<i64>) -> Response {
|
||||
match actions::deny(&state.coord, id) {
|
||||
Ok(()) => Redirect::to("/").into_response(),
|
||||
Err(e) => error_response(format!("deny {id} failed: {e:#}")),
|
||||
Err(e) => error_response(&format!("deny {id} failed: {e:#}")),
|
||||
}
|
||||
}
|
||||
|
||||
fn error_response(message: String) -> Response {
|
||||
fn error_response(message: &str) -> Response {
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
Html(format!(
|
||||
"<!doctype html>\n<html>\n<head>{STYLE}</head>\n<body>{BANNER}\n<h2>◆ ERR0R ◆</h2>\n<pre class=\"diff\">{message}</pre>\n<p><a href=\"/\">← back</a></p>\n</body></html>",
|
||||
message = html_escape(&message),
|
||||
message = html_escape(message),
|
||||
)),
|
||||
)
|
||||
.into_response()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue