aboutsummaryrefslogtreecommitdiff
path: root/src/client/Update/LoggedIn/Account.elm
blob: ab07c2ed48824340115c56ad491d232de816cf3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Update.LoggedIn.Account
  ( AccountAction(..)
  , updateAccount
  ) where

import Model.User exposing (UserId)
import Model.Payers exposing (..)
import Model.View.LoggedIn.Account exposing (..)

type AccountAction =
  ToggleDetail
  | UpdatePayer UserId Int

updateAccount : AccountAction -> Account -> Account
updateAccount action account =
  case action of
    ToggleDetail ->
      { account | visibleDetail <- not account.visibleDetail }
    UpdatePayer userId cost ->
      { account | payers <- updatePayers account.payers userId cost }