diff options
author | Joris Guyonvarch | 2015-08-01 00:31:36 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-08-01 00:31:36 +0200 |
commit | c345f9daa28e0c174b35413addf78df0a793f8c1 (patch) | |
tree | 206f1d9aeed76b5c9e6f6abd24c00a50ec6c54fd /src/client/Update/Payment | |
parent | 043d315c4b15608e04a07cd709e4caf5c3758c61 (diff) |
Adding error feedbacks when adding a payment
Diffstat (limited to 'src/client/Update/Payment')
-rw-r--r-- | src/client/Update/Payment/Add.elm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/client/Update/Payment/Add.elm b/src/client/Update/Payment/Add.elm new file mode 100644 index 0000000..3ccce73 --- /dev/null +++ b/src/client/Update/Payment/Add.elm @@ -0,0 +1,24 @@ +module Update.Payment.Add + ( AddPaymentAction(..) + , updateAddPayment + ) where + +import Model.View.Payment.Add exposing (AddPayment) + +type AddPaymentAction = + UpdateName String + | UpdateCost String + | AddError (Maybe String) (Maybe String) + +updateAddPayment : AddPaymentAction -> AddPayment -> AddPayment +updateAddPayment action addPayment = + case action of + UpdateName name -> + { addPayment | name <- name } + UpdateCost cost -> + { addPayment | cost <- cost } + AddError nameError costError -> + { addPayment + | nameError <- nameError + , costError <- costError + } |