From d9df5c3fcffe12aac239b58ccf2fd82c19c3be62 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 3 Jan 2016 23:37:14 +0100 Subject: Validate add payment server side --- src/client/elm/View/LoggedIn/AddPayment.elm | 10 +++------- src/client/elm/View/LoggedIn/Paging.elm | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src/client/elm/View') diff --git a/src/client/elm/View/LoggedIn/AddPayment.elm b/src/client/elm/View/LoggedIn/AddPayment.elm index 0b39591..0149432 100644 --- a/src/client/elm/View/LoggedIn/AddPayment.elm +++ b/src/client/elm/View/LoggedIn/AddPayment.elm @@ -2,7 +2,6 @@ module View.LoggedIn.AddPayment ( addPayment ) where -import Reads exposing (readInt) import Result exposing (..) import Signal exposing (Address) @@ -31,13 +30,10 @@ addPayment address model loggedInView = H.form [ let update = if loggedInView.add.waitingServer - then Action.NoOp + then + Action.NoOp else - case (validateName loggedInView.add.name model.translations, validateCost loggedInView.add.cost model.translations) of - (Ok name, Ok cost) -> - UpdateLoggedIn <| LoggedInAction.AddPayment name cost loggedInView.add.frequency - (resName, resCost) -> - UpdateLoggedIn <| UpdateAdd <| AddError (toMaybeError resName) (toMaybeError resCost) + UpdateLoggedIn <| LoggedInAction.AddPayment loggedInView.add.name loggedInView.add.cost loggedInView.add.frequency in onSubmitPrevDefault address update , class "addPayment" ] diff --git a/src/client/elm/View/LoggedIn/Paging.elm b/src/client/elm/View/LoggedIn/Paging.elm index 154686a..b722ee7 100644 --- a/src/client/elm/View/LoggedIn/Paging.elm +++ b/src/client/elm/View/LoggedIn/Paging.elm @@ -8,7 +8,7 @@ import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) -import Model.Action exposing (..) +import Model.Action as Action exposing (..) import Model.Action.LoggedInAction exposing (..) import Model.View.LoggedInView exposing (..) import Model.Payment exposing (perPage) @@ -94,6 +94,6 @@ paymentsPage address loggedInView page = , ("current", onCurrentPage) ] , onClick address <| - if onCurrentPage then NoOp else UpdateLoggedIn (UpdatePage page) + if onCurrentPage then Action.NoOp else UpdateLoggedIn (UpdatePage page) ] [ text (toString page) ] -- cgit v1.2.3