use let* to clean code

This commit is contained in:
Swrup 2022-01-12 15:38:30 +01:00
parent 316a85e335
commit 0b7983ed6c
3 changed files with 171 additions and 252 deletions

View file

@ -136,21 +136,15 @@ let plant_image request =
let nb = int_of_string (Dream.param "nb" request) in
let image = Plant.get_plant_image plant_id nb in
match image with
| Ok (Some image) ->
Dream.respond ~headers:[ ("Content-Type", "image") ] image
| Ok None
| Error _ ->
Dream.empty `Not_Found
| Ok image -> Dream.respond ~headers:[ ("Content-Type", "image") ] image
| Error _ -> Dream.empty `Not_Found
let post_image request =
let post_id = Dream.param "post_id" request in
let image = Babillard.get_post_image post_id in
match image with
| Ok (Some image) ->
Dream.respond ~headers:[ ("Content-Type", "image") ] image
| Ok None
| Error _ ->
Dream.empty `Not_Found
| Ok image -> Dream.respond ~headers:[ ("Content-Type", "image") ] image
| Error _ -> Dream.empty `Not_Found
let add_plant_get request =
match Dream.session "nick" request with