diff options
Diffstat (limited to 'src/client/elm/Update.elm')
-rw-r--r-- | src/client/elm/Update.elm | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/client/elm/Update.elm b/src/client/elm/Update.elm index 73dde9b..a33d47d 100644 --- a/src/client/elm/Update.elm +++ b/src/client/elm/Update.elm @@ -31,7 +31,7 @@ update action model = (model, Effects.none) SignIn assertion -> - ( applySignIn model (SignInAction.Connecting) + ( applySignIn model (SignInAction.WaitingServer) , sendRequest (Communication.SignIn assertion) |> flip Task.onError (\_ -> Task.succeed (UpdateSignIn (SignInAction.ErrorLogin (getMessage "ErrorSignIn" model.translations))) @@ -61,16 +61,23 @@ update action model = (applySignIn model signInAction, Effects.none) UpdateLoggedIn loggedInAction -> - (applyLoggedIn model loggedInAction, Effects.none) + applyLoggedIn model loggedInAction applySignIn : Model -> SignInAction -> Model applySignIn model signInAction = case model.view of - V.SignInView signInView -> { model | view = V.SignInView (updateSignIn signInAction signInView) } - _ -> model + V.SignInView signInView -> + { model | view = V.SignInView (updateSignIn signInAction signInView) } + _ -> + model -applyLoggedIn : Model -> LoggedInAction -> Model +applyLoggedIn : Model -> LoggedInAction -> (Model, Effects Action) applyLoggedIn model loggedInAction = case model.view of - V.LoggedInView loggedInView -> { model | view = V.LoggedInView (updateLoggedIn model loggedInAction loggedInView) } - _ -> model + V.LoggedInView loggedInView -> + let (loggedInView, effects) = updateLoggedIn model loggedInAction loggedInView + in ( { model | view = V.LoggedInView loggedInView } + , effects + ) + _ -> + (model, Effects.none) |