aboutsummaryrefslogtreecommitdiff
path: root/src/client/Update/SignIn.elm
blob: 0aa7c841684e8f2db48ea24b1e8cab3e72624c4e (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
module Update.SignIn
  ( SignInAction(..)
  , updateSignIn
  ) where

import Model.View.SignInView exposing (..)

type SignInAction =
  UpdateLogin String
  | ValidLogin String
  | ErrorLogin String

updateSignIn : SignInAction -> SignInView -> SignInView
updateSignIn action signInView =
  case action of
    UpdateLogin login ->
      { signInView | login <- login }
    ValidLogin message ->
      { signInView
      | login <- ""
      , result <- Just (Ok message)
      }
    ErrorLogin message ->
      { signInView | result <- Just (Err message) }