From c345f9daa28e0c174b35413addf78df0a793f8c1 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sat, 1 Aug 2015 00:31:36 +0200 Subject: Adding error feedbacks when adding a payment --- src/client/Update/Payment/Add.elm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/client/Update/Payment/Add.elm (limited to 'src/client/Update/Payment/Add.elm') 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 + } -- cgit v1.2.3