update the settings routes

This commit is contained in:
tamo 2021-03-29 20:19:37 +02:00
parent 96cffeab1e
commit 79c63049d7
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
2 changed files with 9 additions and 2 deletions

View file

@ -131,7 +131,9 @@ async fn update_all(
.update_settings(index_uid.into_inner(), body.into_inner(), true)
.await
{
Ok(update_result) => Ok(HttpResponse::Accepted().json(update_result)),
Ok(update_result) => {
Ok(HttpResponse::Accepted().json(serde_json::json!({ "updateId": update_result.id() })))
}
Err(e) => {
Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })))
}
@ -161,7 +163,9 @@ async fn delete_all(
.update_settings(index_uid.into_inner(), settings, false)
.await
{
Ok(update_result) => Ok(HttpResponse::Accepted().json(update_result)),
Ok(update_result) => {
Ok(HttpResponse::Accepted().json(serde_json::json!({ "updateId": update_result.id() })))
}
Err(e) => {
Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })))
}