Solution for intro/part7
This commit is contained in:
@@ -182,26 +182,12 @@ type alias Metadata =
|
|||||||
|
|
||||||
metadataDecoder : Decoder Metadata
|
metadataDecoder : Decoder Metadata
|
||||||
metadataDecoder =
|
metadataDecoder =
|
||||||
{- 👉 TODO: replace the calls to `hardcoded` with calls to `required`
|
|
||||||
in order to decode these fields:
|
|
||||||
|
|
||||||
--- "description" -------> description : String
|
|
||||||
--- "title" -------------> title : String
|
|
||||||
--- "tagList" -----------> tags : List String
|
|
||||||
--- "favorited" ---------> favorited : Bool
|
|
||||||
--- "favoritesCount" ----> favoritesCount : Int
|
|
||||||
|
|
||||||
Once this is done, the articles in the feed should look normal again.
|
|
||||||
|
|
||||||
💡 HINT: Order matters! These must be decoded in the same order
|
|
||||||
as the order of the fields in `type alias Metadata` above. ☝️
|
|
||||||
-}
|
|
||||||
Decode.succeed Metadata
|
Decode.succeed Metadata
|
||||||
|> hardcoded "(needs decoding!)"
|
|> required "description" string
|
||||||
|> hardcoded "(needs decoding!)"
|
|> required "title" string
|
||||||
|> hardcoded []
|
|> required "tagList" (list string)
|
||||||
|> hardcoded False
|
|> required "favorited" bool
|
||||||
|> hardcoded 0
|
|> required "favoritesCount" int
|
||||||
|> required "createdAt" Timestamp.iso8601Decoder
|
|> required "createdAt" Timestamp.iso8601Decoder
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user