Last active
July 18, 2018 22:30
-
-
Save rippinrobr/9a5943928288cfa65476d3f13e0b8a22 to your computer and use it in GitHub Desktop.
The init function - creates the model with default values and uses it as part of the command that retrieves the categores
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- init does what you might think it does, it initializes the applicaiton. | |
-- In this app, I need to fetch the list of tags when the page loads so | |
-- the user has some navigation to work with so I make the call to the | |
-- httpCommand function. | |
init : ( Model, Cmd Msg ) | |
init = | |
let model = { categories = [] | |
, errorMsg = Nothing | |
, selectedTag = "All" | |
, summaries = [] | |
} | |
in | |
( model, getCategoriesCommand) | |
.......... some other code .......... | |
main : Program Never Model Msg | |
main = | |
program | |
{ init = init | |
, view = view | |
, update = update | |
, subscriptions = \_ -> Sub.none | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment