Skip to content

Commit

Permalink
🐛 fix wsod on null-value for image from API
Browse files Browse the repository at this point in the history
API seems to have changed when more beers were added recently. If an
image is missing it now hard returns `null`, instead of undefined
  • Loading branch information
luhmann committed Apr 8, 2019
1 parent efcb3c7 commit 4d0b554
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Beer.re
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type brew = {
id: int,
name: string,
tagline: string,
image: string,
image: Js.Nullable.t(string),
description: string,
abv: float,
ibu: int,
Expand All @@ -21,13 +21,13 @@ let make =
~ibu,
~ebc,
~foodPairing,
~image=?,
~image,
_children
) => {
...component,
render: _self => {
let imageItem =
switch image {
switch (Js.Nullable.toOption(image)) {
| None => ReasonReact.nullElement
| Some(img_url) =>
let url =
Expand Down

0 comments on commit 4d0b554

Please sign in to comment.