aboutsummaryrefslogtreecommitdiff
path: root/src/client/SignIn/Update.elm
blob: 98de777ae19e88fb57948887f340730b6dda32cd (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 msg signInView =
  case msg of
    UpdateLogin login ->
      { signInView |
      login = login
      }
    WaitingServer ->
      { signInView
      | waitingServer = True
      }
    ValidLogin ->
      { signInView
      | login = ""
      , result = Just (Ok (getMessage translations "SignInEmailSent"))
      , waitingServer = False
      }
    ErrorLogin message ->
      { signInView
      | result = Just (Err message)
      , waitingServer = False
      }