aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm')
-rw-r--r--src/client/elm/LoggedIn/Income/Model.elm6
-rw-r--r--src/client/elm/LoggedIn/Update.elm8
2 files changed, 12 insertions, 2 deletions
diff --git a/src/client/elm/LoggedIn/Income/Model.elm b/src/client/elm/LoggedIn/Income/Model.elm
index 873eaf1..4c82ab1 100644
--- a/src/client/elm/LoggedIn/Income/Model.elm
+++ b/src/client/elm/LoggedIn/Income/Model.elm
@@ -2,6 +2,7 @@ module LoggedIn.Income.Model exposing
( Model
, AddIncome
, init
+ , initForm
)
import String exposing (toInt, split)
@@ -24,9 +25,12 @@ type alias AddIncome =
init : Model
init =
- { addIncome = Form.initial [] validate
+ { addIncome = initForm
}
+initForm : Form String AddIncome
+initForm = Form.initial [] validate
+
validate : Validation String AddIncome
validate =
form2 AddIncome
diff --git a/src/client/elm/LoggedIn/Update.elm b/src/client/elm/LoggedIn/Update.elm
index 6d8869a..23f242d 100644
--- a/src/client/elm/LoggedIn/Update.elm
+++ b/src/client/elm/LoggedIn/Update.elm
@@ -29,6 +29,8 @@ import LoggedIn.Income.Update as IncomeUpdate
import LoggedIn.Home.AddPayment.Msg as AddPaymentMsg
import LoggedIn.Home.AddPayment.Update as AddPaymentUpdate
+import LoggedIn.Income.Model as IncomeModel
+
import Utils.Tuple as Tuple
import Utils.Cmd exposing ((:>))
@@ -116,7 +118,11 @@ update model action loggedIn =
LoggedInMsg.ValidateAddIncome incomeId time amount ->
let newIncome = { userId = loggedIn.me, time = time, amount = amount }
- in ( { loggedIn | incomes = Dict.insert incomeId newIncome loggedIn.incomes }
+ loggedInIncome = loggedIn.income
+ in ( { loggedIn
+ | incomes = Dict.insert incomeId newIncome loggedIn.incomes
+ , income = { loggedInIncome | addIncome = IncomeModel.initForm }
+ }
, Cmd.none
)