use let* to clean code
This commit is contained in:
parent
d540e25746
commit
8e44a11067
3 changed files with 171 additions and 252 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue