aboutsummaryrefslogtreecommitdiff
path: root/client/src/View/Payment
diff options
context:
space:
mode:
authorJoris2018-10-30 20:44:12 +0100
committerJoris2018-10-30 20:44:12 +0100
commitb5244184920b4d7a8d64eada2eca21e9a6ea2df9 (patch)
treec15f9e30cb31a3fb067e0660f9cf62a94d452a4c /client/src/View/Payment
parent8a28f608d8e08fba4bbe54b46804d261686c3c03 (diff)
Use waitfor with delete confirm button
Diffstat (limited to 'client/src/View/Payment')
-rw-r--r--client/src/View/Payment/Add.hs3
-rw-r--r--client/src/View/Payment/Delete.hs12
2 files changed, 6 insertions, 9 deletions
diff --git a/client/src/View/Payment/Add.hs b/client/src/View/Payment/Add.hs
index 602f7f3..1864e76 100644
--- a/client/src/View/Payment/Add.hs
+++ b/client/src/View/Payment/Add.hs
@@ -93,8 +93,7 @@ view addIn = do
(result, waiting) <- WaitFor.waitFor
(Ajax.postJson "/payment")
- validate
- payment
+ (R.tag (R.current payment) validate)
cancel <- Component._buttonOut_clic <$> (Component.button $
(Component.defaultButtonIn (R.text $ Msg.get Msg.Dialog_Undo))
diff --git a/client/src/View/Payment/Delete.hs b/client/src/View/Payment/Delete.hs
index 330ef9f..81c7c57 100644
--- a/client/src/View/Payment/Delete.hs
+++ b/client/src/View/Payment/Delete.hs
@@ -15,7 +15,7 @@ import Component (ButtonIn (..), ButtonOut (..))
import qualified Component as Component
import qualified Util.Ajax as Ajax
import qualified Util.Either as EitherUtil
--- import qualified Util.WaitFor as WaitFor
+import qualified Util.WaitFor as WaitFor
data DeleteIn t = DeleteIn
{ _deleteIn_id :: Dynamic t PaymentId
@@ -39,18 +39,16 @@ view deleteIn =
(Component.defaultButtonIn (R.text $ Msg.get Msg.Dialog_Confirm))
{ _buttonIn_class = R.constDyn "confirm"
, _buttonIn_submit = True
+ , _buttonIn_waiting = waiting
})
let url = flip fmap (_deleteIn_id deleteIn) (\id ->
T.concat ["/payment/", T.pack . show $ id]
)
- result <- Ajax.delete url confirm
-
- -- (_, waiting) <- WaitFor.waitFor
- -- (Ajax.delete "/payment")
- -- validate
- -- payment
+ (result, waiting) <- WaitFor.waitFor
+ (Ajax.delete url)
+ confirm
cancel <- Component._buttonOut_clic <$> (Component.button $
(Component.defaultButtonIn (R.text $ Msg.get Msg.Dialog_Undo))