Skip to content

Instantly share code, notes, and snippets.

@rippinrobr
Last active July 18, 2018 21:52
Show Gist options
  • Save rippinrobr/b8a49a94a3fa08c2fb6921877df8afbc to your computer and use it in GitHub Desktop.
Save rippinrobr/b8a49a94a3fa08c2fb6921877df8afbc to your computer and use it in GitHub Desktop.
The case matches that pertain to retrieving the categories
- update drives the changes in the UI and interaction with the server.
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
DataReceived (Ok categories) ->
({ model | categories = categories, errorMsg = Nothing }, Cmd.none)
DataReceived (Err httpError) ->
({ model | errorMsg = Just (createErrorMessage httpError) }, Cmd.none)
... pretend the rest of the case options are here ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment