aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/SignIn/Update.elm
blob: f4152a6f3b9c4b7be30170f6566e925632a15bcd (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
  ( update
  ) where

import SignIn.Model exposing (..)
import SignIn.Action exposing (..)

import Model.Translations exposing (getMessage, Translations)

update : Translations -> Action -> 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
      }