diff options
author | Joris | 2016-01-03 00:19:55 +0100 |
---|---|---|
committer | Joris | 2016-01-03 00:28:41 +0100 |
commit | 0cba27cba2b44756389d50bc113f23a2be87e978 (patch) | |
tree | cc13e5ba32e3e2ec8bad284828a06d5daedec4f7 /src/client/elm/Update.elm | |
parent | fc9a3ca6a5226f78a3a0ec51af3d8d287ccb2e1b (diff) |
Prevent to send multiple payments if the server is not answering
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) |