From 166cd04e4b28770ede854dafc9ae30eae64102fe Mon Sep 17 00:00:00 2001 From: Joris Date: Mon, 28 Mar 2016 17:51:14 +0200 Subject: Create an empty but reachable user page --- src/client/elm/LoggedIn/AddPayment/Update.elm | 55 --------------------------- 1 file changed, 55 deletions(-) delete mode 100644 src/client/elm/LoggedIn/AddPayment/Update.elm (limited to 'src/client/elm/LoggedIn/AddPayment/Update.elm') diff --git a/src/client/elm/LoggedIn/AddPayment/Update.elm b/src/client/elm/LoggedIn/AddPayment/Update.elm deleted file mode 100644 index eb4384b..0000000 --- a/src/client/elm/LoggedIn/AddPayment/Update.elm +++ /dev/null @@ -1,55 +0,0 @@ -module LoggedIn.AddPayment.Update - ( update - , addPaymentError - ) where - -import Maybe -import Json.Decode as Json exposing ((:=)) - -import LoggedIn.AddPayment.Action as AddPaymentAction -import LoggedIn.AddPayment.Model as AddPaymentModel - -import Model.Translations exposing (Translations, getMessage) -import Model.Payment exposing (PaymentFrequency(..)) - -update : AddPaymentAction.Action -> AddPaymentModel.Model -> AddPaymentModel.Model -update action addPayment = - case action of - - AddPaymentAction.NoOp -> - addPayment - - AddPaymentAction.UpdateName name -> - { addPayment | name = name } - - AddPaymentAction.UpdateCost cost -> - { addPayment | cost = cost } - - AddPaymentAction.AddError nameError costError -> - { addPayment - | nameError = nameError - , costError = costError - , waitingServer = False - } - - AddPaymentAction.ToggleFrequency -> - { addPayment - | frequency = if addPayment.frequency == Punctual then Monthly else Punctual - } - - AddPaymentAction.WaitingServer -> - { addPayment | waitingServer = True } - -addPaymentError : Translations -> String -> Maybe AddPaymentAction.Action -addPaymentError translations jsonErr = - let decoder = - Json.object2 (,) - (Json.maybe <| "name" := Json.string) - (Json.maybe <| "cost" := Json.string) - in case Json.decodeString decoder jsonErr of - Err _ -> - Nothing - Ok (mbNameKey, mbCostKey) -> - Just <| AddPaymentAction.AddError - (Maybe.map (flip getMessage translations) mbNameKey) - (Maybe.map (flip getMessage translations) mbCostKey) -- cgit v1.2.3