dashboard: /approve, /deny, /answer-question, /cancel-question, /request-spawn return 200; matching forms opt out of refetch

This commit is contained in:
müde 2026-05-17 14:26:53 +02:00
parent d8d393da6d
commit f559441a06
2 changed files with 28 additions and 12 deletions

View file

@ -783,7 +783,11 @@ async fn dashboard_stream(
async fn post_approve(State(state): State<AppState>, AxumPath(id): AxumPath<i64>) -> Response {
match actions::approve(state.coord.clone(), id).await {
Ok(()) => Redirect::to("/").into_response(),
// 200 instead of 303 — `actions::approve` fires
// `ApprovalResolved` (success path) or the eventual failure
// event, both of which the dashboard's derived store applies
// live. The matching form carries `data-no-refresh`.
Ok(()) => (StatusCode::OK, "ok").into_response(),
Err(e) => error_response(&format!("approve {id} failed: {e:#}")),
}
}
@ -805,7 +809,7 @@ async fn post_deny(
.map(str::trim)
.filter(|s| !s.is_empty());
match actions::deny(&state.coord, id, note).await {
Ok(()) => Redirect::to("/").into_response(),
Ok(()) => (StatusCode::OK, "ok").into_response(),
Err(e) => error_response(&format!("deny {id} failed: {e:#}")),
}
}
@ -853,7 +857,7 @@ async fn post_answer_question(
false,
);
}
Redirect::to("/").into_response()
(StatusCode::OK, "ok").into_response()
}
Err(e) => error_response(&format!("answer {id} failed: {e:#}")),
}
@ -894,7 +898,7 @@ async fn post_cancel_question(
answerer: hive_sh4re::OPERATOR_RECIPIENT.to_owned(),
},
);
Redirect::to("/").into_response()
(StatusCode::OK, "ok").into_response()
}
Err(e) => error_response(&format!("cancel-question {id} failed: {e:#}")),
}
@ -1199,7 +1203,7 @@ async fn post_request_spawn(
state
.coord
.emit_approval_added(id, &name, "spawn", None, None, None);
Redirect::to("/").into_response()
(StatusCode::OK, "ok").into_response()
}
Err(e) => error_response(&format!("request-spawn {name} failed: {e:#}")),
}