aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Update.elm
diff options
context:
space:
mode:
authorJoris2016-01-04 00:34:48 +0100
committerJoris2016-01-04 00:40:25 +0100
commit6b090b3bdef7108d51d93207e28b148c121767aa (patch)
treef0815d638723b62b5f16cf9d94ce5783751fc3db /src/client/elm/Update.elm
parentd9df5c3fcffe12aac239b58ccf2fd82c19c3be62 (diff)
downloadbudget-6b090b3bdef7108d51d93207e28b148c121767aa.tar.gz
budget-6b090b3bdef7108d51d93207e28b148c121767aa.tar.bz2
budget-6b090b3bdef7108d51d93207e28b148c121767aa.zip
Simplify server communicaitons in client
Diffstat (limited to 'src/client/elm/Update.elm')
-rw-r--r--src/client/elm/Update.elm8
1 files changed, 4 insertions, 4 deletions
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
)