diff options
author | Joris | 2016-01-03 19:41:31 +0100 |
---|---|---|
committer | Joris | 2016-01-03 19:41:31 +0100 |
commit | a8309988518af5bddf62d6a326d990fde4069b40 (patch) | |
tree | 6ff9c0af27d78f8579b5c3975378a3c82899593c /src/client/elm/Update.elm | |
parent | 0cba27cba2b44756389d50bc113f23a2be87e978 (diff) |
Set focus properties to button elements
Diffstat (limited to 'src/client/elm/Update.elm')
-rw-r--r-- | src/client/elm/Update.elm | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/client/elm/Update.elm b/src/client/elm/Update.elm index a33d47d..b473c9d 100644 --- a/src/client/elm/Update.elm +++ b/src/client/elm/Update.elm @@ -6,7 +6,7 @@ import Task import Effects exposing (Effects) -import ServerCommunication exposing (sendRequest) +import Server import Model exposing (Model) import Model.Translations exposing (getMessage) @@ -16,7 +16,6 @@ import Model.Action.LoggedInAction exposing (LoggedInAction) import Model.View as V import Model.View.SignInView exposing (..) import Model.View.LoggedInView exposing (..) -import Model.Communication as Communication exposing (Communication) import Update.LoggedIn exposing (updateLoggedIn) import Update.SignIn exposing (updateSignIn) @@ -32,25 +31,25 @@ update action model = SignIn assertion -> ( applySignIn model (SignInAction.WaitingServer) - , sendRequest (Communication.SignIn assertion) + , Server.signIn assertion |> flip Task.onError (\_ -> Task.succeed (UpdateSignIn (SignInAction.ErrorLogin (getMessage "ErrorSignIn" model.translations))) ) |> Effects.task ) - GoLoggedInView users me monthlyPayments payments paymentsCount payers -> - ( { model | view = V.LoggedInView (initLoggedInView users me monthlyPayments payments paymentsCount payers) } - , Effects.none - ) - - ServerCommunication communication -> + SetIncome currentTime amount -> ( model - , sendRequest communication + , Server.setIncome currentTime amount |> flip Task.onError (always <| Task.succeed NoOp) |> Effects.task ) + GoLoggedInView users me monthlyPayments payments paymentsCount payers -> + ( { model | view = V.LoggedInView (initLoggedInView users me monthlyPayments payments paymentsCount payers) } + , Effects.none + ) + UpdateTime time -> ({ model | currentTime = time }, Effects.none) @@ -63,6 +62,13 @@ update action model = UpdateLoggedIn loggedInAction -> applyLoggedIn model loggedInAction + SignOut -> + ( model + , Server.signOut + |> flip Task.onError (always <| Task.succeed NoOp) + |> Effects.task + ) + applySignIn : Model -> SignInAction -> Model applySignIn model signInAction = case model.view of @@ -77,7 +83,7 @@ applyLoggedIn model loggedInAction = V.LoggedInView loggedInView -> let (loggedInView, effects) = updateLoggedIn model loggedInAction loggedInView in ( { model | view = V.LoggedInView loggedInView } - , effects + , Effects.map UpdateLoggedIn effects ) _ -> (model, Effects.none) |