aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/SignIn/Update.elm
blob: 28307e429951967334cd8dce9c8281a15b8d4133 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module SignIn.Update exposing
  ( update
  )

import SignIn.Model exposing (..)
import SignIn.Msg exposing (..)

import Model.Translations exposing (getMessage, Translations)

update : Translations -> Msg -> Model -> Model
update translations action signInView =
  case action of
    UpdateLogin login ->
      { signInView |
      login = login
      }
    WaitingServer ->
      { signInView
      | waitingServer = True
      }
    ValidLogin ->
      { signInView
      | login = ""
      , result = Just (Ok (getMessage "SignInEmailSent" translations))
      , waitingServer = False
      }
    ErrorLogin message ->
      { signInView
      | result = Just (Err message)
      , waitingServer = False
      }