diff options
Diffstat (limited to 'src/client/elm/Update.elm')
-rw-r--r-- | src/client/elm/Update.elm | 11 |
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 ) |