aboutsummaryrefslogtreecommitdiff
path: root/client/src/View
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
parent8a28f608d8e08fba4bbe54b46804d261686c3c03 (diff)
Use waitfor with delete confirm button
Diffstat (limited to 'client/src/View')
-rw-r--r--client/src/View/Payment/Add.hs3
-rw-r--r--client/src/View/Payment/Delete.hs12
-rw-r--r--client/src/View/SignIn.hs3
3 files changed, 7 insertions, 11 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))
diff --git a/client/src/View/SignIn.hs b/client/src/View/SignIn.hs
index 7f53299..428997e 100644
--- a/client/src/View/SignIn.hs
+++ b/client/src/View/SignIn.hs
@@ -41,8 +41,7 @@ view signInMessage =
(signInResult, waiting) <- WaitFor.waitFor
(\email -> Ajax.postJson "/askSignIn" (SignIn <$> email))
- (_buttonOut_clic button)
- (_inputOut_value input)
+ (R.tag (R.current (_inputOut_value input)) (_buttonOut_clic button))
showSignInResult signInMessage signInResult