Skip to content

Instantly share code, notes, and snippets.

@rippinrobr
Created July 18, 2018 21:38
Show Gist options
  • Save rippinrobr/e15c2a5462cf39d341e4511106375fc1 to your computer and use it in GitHub Desktop.
Save rippinrobr/e15c2a5462cf39d341e4511106375fc1 to your computer and use it in GitHub Desktop.
-- getCategoriesCommand is responsible for making the HTTP GET
-- call to fetch the tags. |> is a pipe operator and I'm using to create a 'pipeline'.
-- The Json.Decode.list tagDecoder is passed to the Http.get call as the last parameter
-- and is responsible for turning the JSON Array of categories into an Elm list of Categories.
-- The List of Categories from the decoder become the parameter of the DataRecieved Msg and
-- eventually become the navigation list
getCategoriesCommand : Cmd Msg
getCategoriesCommand =
Json.Decode.list categoryDecoder
|> Http.get "http://localhost:8088/categories"
|> Http.send DataReceived
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment