Solution for advanced/part2
This commit is contained in:
@@ -159,8 +159,8 @@ slug (Article internals _) =
|
||||
|
||||
|
||||
body : Article Full -> Body
|
||||
body _ =
|
||||
"👉 TODO make this return the article's body"
|
||||
body (Article _ (Full bod)) =
|
||||
bod
|
||||
|
||||
|
||||
|
||||
@@ -181,8 +181,8 @@ mapAuthor transform (Article info extras) =
|
||||
|
||||
|
||||
fromPreview : Body -> Article Preview -> Article Full
|
||||
fromPreview _ _ =
|
||||
"👉 TODO convert from an Article Preview to an Article Full"
|
||||
fromPreview bod (Article info _) =
|
||||
Article info (Full bod)
|
||||
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ fullDecoder : Maybe Cred -> Decoder (Article Full)
|
||||
fullDecoder maybeCred =
|
||||
Decode.succeed Article
|
||||
|> custom (internalsDecoder maybeCred)
|
||||
|> required "body" "👉 TODO use `Body.decoder` (which is a `Decoder Body`) to decode the body into this Article Full"
|
||||
|> required "body" (Decode.map Full Body.decoder)
|
||||
|
||||
|
||||
internalsDecoder : Maybe Cred -> Decoder Internals
|
||||
|
||||
Reference in New Issue
Block a user