I am new to Elm and I am trying to decode a json response but returning back to view is having errors please i need ideas seems i am missing something
type alias Entry =
{ title : String
, department_name : String
, external_reference_id : String
}
decoderEntry : Decode.Decoder Entry
decoderEntry =
Json.Decode.Pipeline.decode Entry
|> required "title" Decode.string
|> required "department_name" Decode.string
|> required "external_reference_id" Decode.string
decodeEntry : Decode.Decoder Entry -> String -> Result String Entry
decodeEntry decoder =
Decode.decodeString decoder
then my request object looks like this
getEntry : String -> Http.Request (Entry)
getEntry reqval =
Http.get ("api/entry/job/" ++ reqval)
(decodeEntry decoderEntry)
For now i get the error
Function `get` is expecting the 2nd argument to be:
Json.Decode.Decoder a
But it is:
String -> Result String Requisition