aboutsummaryrefslogtreecommitdiff
path: root/client/src/Component
diff options
context:
space:
mode:
authorJoris2019-10-09 23:16:00 +0200
committerJoris2019-10-09 23:16:04 +0200
commit7529a18ff0ac443e7f9764b5e2d0f57a5d3a850b (patch)
tree3d5cfc1f2318c2d4f889ee70764929f1a96e4c41 /client/src/Component
parente5ac82f4808e974dec5f19fc6f059efaa5214022 (diff)
downloadbudget-7529a18ff0ac443e7f9764b5e2d0f57a5d3a850b.tar.gz
budget-7529a18ff0ac443e7f9764b5e2d0f57a5d3a850b.tar.bz2
budget-7529a18ff0ac443e7f9764b5e2d0f57a5d3a850b.zip
Use common payment validation in the backend
Remove deprecated backend validation
Diffstat (limited to 'client/src/Component')
-rw-r--r--client/src/Component/Select.hs11
1 files changed, 3 insertions, 8 deletions
diff --git a/client/src/Component/Select.hs b/client/src/Component/Select.hs
index 5980ed2..102f554 100644
--- a/client/src/Component/Select.hs
+++ b/client/src/Component/Select.hs
@@ -9,11 +9,10 @@ import qualified Data.Map as M
import qualified Data.Maybe as Maybe
import Data.Text (Text)
import qualified Data.Text as T
-import Data.Validation (Validation (Failure, Success))
+import Data.Validation (Validation)
import Reflex.Dom (Dynamic, Event, MonadWidget, Reflex)
import qualified Reflex.Dom as R
-import qualified Common.Msg as Msg
import qualified Util.Validation as ValidationUtil
data (Reflex t) => SelectIn t a b c = SelectIn
@@ -22,7 +21,7 @@ data (Reflex t) => SelectIn t a b c = SelectIn
, _selectIn_value :: Event t a
, _selectIn_values :: Dynamic t (Map a Text)
, _selectIn_reset :: Event t b
- , _selectIn_isValid :: a -> Bool
+ , _selectIn_isValid :: a -> Validation Text a
, _selectIn_validate :: Event t c
}
@@ -41,11 +40,7 @@ select selectIn = do
])
validatedValue =
- R.ffor value (\v ->
- if _selectIn_isValid selectIn v then
- Success v
- else
- Failure (Msg.get Msg.Form_NonEmpty))
+ fmap (_selectIn_isValid selectIn) value
maybeError =
fmap ValidationUtil.maybeError validatedValue