aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Update.elm
diff options
context:
space:
mode:
authorJoris2016-03-11 23:21:06 +0100
committerJoris2016-03-11 23:21:06 +0100
commit9d57e149fcb124a28813c56f83cf254eb92baa42 (patch)
treeb796c4fdc738006c07e65e01f4845adafe064d2a /src/client/elm/Update.elm
parent709d1cf587e92508ef73bca8e847cfa510c03069 (diff)
downloadbudget-9d57e149fcb124a28813c56f83cf254eb92baa42.tar.gz
budget-9d57e149fcb124a28813c56f83cf254eb92baa42.tar.bz2
budget-9d57e149fcb124a28813c56f83cf254eb92baa42.zip
Don't use persona anymore, use email token to sign in
Diffstat (limited to 'src/client/elm/Update.elm')
-rw-r--r--src/client/elm/Update.elm11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/client/elm/Update.elm b/src/client/elm/Update.elm
index bfc3bf6..948ab1f 100644
--- a/src/client/elm/Update.elm
+++ b/src/client/elm/Update.elm
@@ -20,6 +20,8 @@ import Model.View.LoggedInView exposing (..)
import Update.LoggedIn exposing (updateLoggedIn)
import Update.SignIn exposing (updateSignIn)
+import Utils.Http exposing (errorKey)
+
update : Action -> Model -> (Model, Effects Action)
update action model =
case action of
@@ -27,12 +29,13 @@ update action model =
NoOp ->
(model, Effects.none)
- SignIn assertion ->
+ SignIn email ->
( applySignIn model (SignInAction.WaitingServer)
- , Server.signIn assertion
+ , Server.signIn email
|> Task.map GoLoggedInView
- |> flip Task.onError (\_ ->
- Task.succeed (UpdateSignIn (SignInAction.ErrorLogin (getMessage "ErrorSignIn" model.translations)))
+ |> flip Task.onError (\error ->
+ let errorMessage = getMessage (errorKey error) model.translations
+ in Task.succeed (UpdateSignIn (SignInAction.ErrorLogin errorMessage))
)
|> Effects.task
)