aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Update.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/Update.elm')
-rw-r--r--src/client/elm/Update.elm16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/client/elm/Update.elm b/src/client/elm/Update.elm
index c955f8c..c61e2f5 100644
--- a/src/client/elm/Update.elm
+++ b/src/client/elm/Update.elm
@@ -9,15 +9,20 @@ import Effects exposing (Effects)
import ServerCommunication exposing (sendRequest)
import Model exposing (Model)
+import Model.Translations exposing (getMessage)
import Model.Action exposing (..)
+import Model.Action.SignInAction as SignInAction
import Model.View as V
import Model.View.SignInView exposing (..)
import Model.View.LoggedInView exposing (..)
-import Model.Communication exposing (Communication)
+import Model.Communication as Communication exposing (Communication)
import Update.LoggedIn exposing (updateLoggedIn)
import Update.SignIn exposing (updateSignIn)
+import SimpleHTTP exposing (post)
+import InitViewAction exposing (initViewAction)
+
update : Action -> Model -> (Model, Effects Action)
update action model =
case action of
@@ -25,6 +30,15 @@ update action model =
NoOp ->
(model, Effects.none)
+ SignIn assertion ->
+ ( case model.view of
+ V.SignInView signInView -> { model | view = V.SignInView (updateSignIn SignInAction.Connecting signInView) }
+ _ -> model
+ , sendRequest (Communication.SignIn assertion)
+ |> flip Task.onError (always <| Task.succeed (UpdateSignIn (SignInAction.ErrorLogin (getMessage "ErrorSignIn" model.translations))))
+ |> Effects.task
+ )
+
ServerCommunication communication ->
( model
, sendRequest communication