aboutsummaryrefslogtreecommitdiff
path: root/src/client/Update.elm
blob: 39378884ebd223c115e117e04182957c0e227034 (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
module Update
  ( Action(..)
  , actions
  , updateModel
  ) where

import Model exposing (Model)
import Model.Payment exposing (Payments)
import Model.View exposing (..)

type Action =
  NoOp
  | SignIn
  | UpdateLogin String
  | UpdatePayments Payments

actions : Signal.Mailbox Action
actions = Signal.mailbox NoOp

updateModel : Action -> Model -> Model
updateModel action model =
  case action of
    NoOp ->
      model
    SignIn ->
      { model | view <- SignInView "" }
    UpdateLogin login ->
      { model | view <- SignInView login }
    UpdatePayments payments ->
      { model | view <- PaymentView payments }