File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
recipes/CatGifsHalogenHooks/src Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ hookComponent = Hooks.component \_ _ -> Hooks.do
5252 httpResult = case errorOrResponse of
5353 Right jsonRec | jsonRec.status == StatusCode 200 ->
5454 case decodeJson jsonRec.body of
55- Right rec -> RD.Success rec.data.image_url
55+ Right rec -> RD.Success rec.data.images.downsized.url
5656 _ -> RD.Failure " decode error"
5757 _ ->
5858 RD.Failure " http error"
@@ -91,9 +91,13 @@ hookComponent = Hooks.component \_ _ -> Hooks.do
9191 ]
9292 ]
9393
94- decodeJson :: Json -> Either JsonDecodeError { data :: { image_url :: String } }
94+ decodeJson :: Json -> Either JsonDecodeError { data :: { images :: { downsized :: { url :: String } } } }
9595decodeJson = decode $
9696 CA .object " data" $ CAR .record
97- { data: CA .object " image_url" $ CAR .record
98- { image_url: CA .string }
97+ { data: CA .object " images" $ CAR .record
98+ { images: CA .object " downsized" $ CAR .record
99+ { downsized: CA .object " url" $ CAR .record
100+ { url: CA .string }
101+ }
102+ }
99103 }
You can’t perform that action at this time.
0 commit comments