diff options
author | William Carroll <wpcarro@gmail.com> | 2020-07-29T08·51+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-07-29T08·51+0100 |
commit | 289cae2528946aa5d745e904cdaaec7df1a71493 (patch) | |
tree | bef174f051aa60e7a388a3383b8b19d65b5cbffb /client/src/State.elm | |
parent | cf6c8799ab86278c827d4236a7a89163c61c29b9 (diff) |
Add Elm boilerplate to project
Create a top-level client directory to store my Elm boilerplate.
Diffstat (limited to 'client/src/State.elm')
-rw-r--r-- | client/src/State.elm | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/client/src/State.elm b/client/src/State.elm new file mode 100644 index 000000000000..c1edae8bb638 --- /dev/null +++ b/client/src/State.elm @@ -0,0 +1,43 @@ +module State exposing (..) + + +type Msg + = DoNothing + | SetView View + + +type View + = Landing + | Login + + +type alias Model = + { isLoading : Bool + , view : View + } + + +{-| The initial state for the application. +-} +init : Model +init = + { isLoading = False + , view = Landing + } + + +{-| Now that we have state, we need a function to change the state. +-} +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + case msg of + DoNothing -> + ( model, Cmd.none ) + + SetView x -> + ( { model + | view = x + , isLoading = True + } + , Cmd.none + ) |