Better response when swiss is deleted while editing request is handled

Now will return code status 404 instead of 200 with a `null` body.
pull/10015/head
kraktus 2021-10-25 10:25:24 +02:00
parent 876a9a37a3
commit 89e078e698
1 changed files with 7 additions and 1 deletions

View File

@ -231,7 +231,13 @@ final class Swiss(
.bindFromRequest()
.fold(
newJsonFormError,
data => JsonOk { env.swiss.api.update(swiss.id, data) map (_.map(env.swiss.json.api)) }
data => {
env.swiss.api.update(swiss.id, data) map {
_ ?? { swiss =>
JsonOk(env.swiss.json.api(swiss))
}
}
}
)
}
}