From 6b090b3bdef7108d51d93207e28b148c121767aa Mon Sep 17 00:00:00 2001 From: Joris Date: Mon, 4 Jan 2016 00:34:48 +0100 Subject: Simplify server communicaitons in client --- src/client/elm/Update.elm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/client/elm/Update.elm') diff --git a/src/client/elm/Update.elm b/src/client/elm/Update.elm index a78be68..bfc3bf6 100644 --- a/src/client/elm/Update.elm +++ b/src/client/elm/Update.elm @@ -20,8 +20,6 @@ import Model.View.LoggedInView exposing (..) import Update.LoggedIn exposing (updateLoggedIn) import Update.SignIn exposing (updateSignIn) -import SimpleHTTP exposing (post) - update : Action -> Model -> (Model, Effects Action) update action model = case action of @@ -32,14 +30,15 @@ update action model = SignIn assertion -> ( applySignIn model (SignInAction.WaitingServer) , Server.signIn assertion + |> Task.map GoLoggedInView |> 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) } + GoLoggedInView init -> + ( { model | view = V.LoggedInView (initLoggedInView init) } , Effects.none ) @@ -58,6 +57,7 @@ update action model = SignOut -> ( model , Server.signOut + |> Task.map (always GoSignInView) |> flip Task.onError (always <| Task.succeed NoOp) |> Effects.task ) -- cgit v1.2.3