aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/elm/Model/Action/SignInAction.elm2
-rw-r--r--src/client/elm/Server.elm4
-rw-r--r--src/client/elm/Update.elm4
-rw-r--r--src/client/elm/Update/SignIn.elm9
4 files changed, 10 insertions, 9 deletions
diff --git a/src/client/elm/Model/Action/SignInAction.elm b/src/client/elm/Model/Action/SignInAction.elm
index 619dbda..bead018 100644
--- a/src/client/elm/Model/Action/SignInAction.elm
+++ b/src/client/elm/Model/Action/SignInAction.elm
@@ -5,5 +5,5 @@ module Model.Action.SignInAction
type SignInAction =
UpdateLogin String
| WaitingServer
- | ValidLogin String
+ | ValidLogin
| ErrorLogin String
diff --git a/src/client/elm/Server.elm b/src/client/elm/Server.elm
index 9478f2a..c1fb445 100644
--- a/src/client/elm/Server.elm
+++ b/src/client/elm/Server.elm
@@ -30,10 +30,10 @@ init =
`Task.andMap` (Http.get ("number" := Json.int) "/payments/count")
`Task.andMap` (Http.get payersDecoder "/payers")
-signIn : String -> Task Http.Error Init
+signIn : String -> Task Http.Error ()
signIn email =
post ("/signIn?email=" ++ email)
- |> flip Task.andThen (always init)
+ |> Task.map (always ())
addPayment : String -> String -> PaymentFrequency -> Task Http.Error PaymentId
addPayment name cost frequency =
diff --git a/src/client/elm/Update.elm b/src/client/elm/Update.elm
index 948ab1f..adb90ab 100644
--- a/src/client/elm/Update.elm
+++ b/src/client/elm/Update.elm
@@ -32,7 +32,7 @@ update action model =
SignIn email ->
( applySignIn model (SignInAction.WaitingServer)
, Server.signIn email
- |> Task.map GoLoggedInView
+ |> Task.map (always (UpdateSignIn SignInAction.ValidLogin))
|> flip Task.onError (\error ->
let errorMessage = getMessage (errorKey error) model.translations
in Task.succeed (UpdateSignIn (SignInAction.ErrorLogin errorMessage))
@@ -69,7 +69,7 @@ applySignIn : Model -> SignInAction -> Model
applySignIn model signInAction =
case model.view of
V.SignInView signInView ->
- { model | view = V.SignInView (updateSignIn signInAction signInView) }
+ { model | view = V.SignInView (updateSignIn model.translations signInAction signInView) }
_ ->
model
diff --git a/src/client/elm/Update/SignIn.elm b/src/client/elm/Update/SignIn.elm
index f55ce6d..ade5761 100644
--- a/src/client/elm/Update/SignIn.elm
+++ b/src/client/elm/Update/SignIn.elm
@@ -4,9 +4,10 @@ module Update.SignIn
import Model.View.SignInView exposing (..)
import Model.Action.SignInAction exposing (..)
+import Model.Translations exposing (getMessage, Translations)
-updateSignIn : SignInAction -> SignInView -> SignInView
-updateSignIn action signInView =
+updateSignIn : Translations -> SignInAction -> SignInView -> SignInView
+updateSignIn translations action signInView =
case action of
UpdateLogin login ->
{ signInView |
@@ -16,10 +17,10 @@ updateSignIn action signInView =
{ signInView
| waitingServer = True
}
- ValidLogin message ->
+ ValidLogin ->
{ signInView
| login = ""
- , result = Just (Ok message)
+ , result = Just (Ok (getMessage "SignInEmailSent" translations))
, waitingServer = False
}
ErrorLogin message ->