aboutsummaryrefslogtreecommitdiff
path: root/client/src/View/Payment
diff options
context:
space:
mode:
authorJoris2019-11-25 08:17:59 +0100
committerJoris2019-11-25 08:17:59 +0100
commite622e8fdd2e40b4306b5cc724d8dfb76bf976242 (patch)
treeea679b1f701631c37601a1305b8df90e40cdc56e /client/src/View/Payment
parent54628c70cb33de5e4309c35b9f6b57bbe9f7a07b (diff)
Remove Loadable2
Diffstat (limited to 'client/src/View/Payment')
-rw-r--r--client/src/View/Payment/Payment.hs4
-rw-r--r--client/src/View/Payment/Reducer.hs19
2 files changed, 9 insertions, 14 deletions
diff --git a/client/src/View/Payment/Payment.hs b/client/src/View/Payment/Payment.hs
index a97c3df..8d0fee1 100644
--- a/client/src/View/Payment/Payment.hs
+++ b/client/src/View/Payment/Payment.hs
@@ -38,7 +38,7 @@ view input = do
categories <- AjaxUtil.getNow "api/categories"
- R.dyn . R.ffor categories . Loadable.view $ \categories -> do
+ R.dyn . R.ffor categories . Loadable.viewHideValueWhileLoading $ \categories -> do
rec
paymentPage <- Reducer.reducer $ Reducer.In
@@ -69,7 +69,7 @@ view input = do
, HeaderForm._in_categories = categories
}
- result <- Loadable.view2 paymentPage $
+ result <- Loadable.viewShowValueWhileLoading paymentPage $
\(PaymentPage page frequency header payments count) -> do
HeaderInfos.view $ HeaderInfos.In
diff --git a/client/src/View/Payment/Reducer.hs b/client/src/View/Payment/Reducer.hs
index d221ff0..7468097 100644
--- a/client/src/View/Payment/Reducer.hs
+++ b/client/src/View/Payment/Reducer.hs
@@ -13,7 +13,8 @@ import qualified Reflex.Dom as R
import Common.Model (Frequency (..), PaymentPage)
-import Loadable (Loadable2 (..))
+import Loadable (Loadable (..))
+import qualified Loadable as Loadable
import qualified Util.Ajax as AjaxUtil
import qualified Util.Either as EitherUtil
@@ -44,7 +45,7 @@ data Msg
| ResetSearch
deriving Show
-reducer :: forall t m a b c. MonadWidget t m => In t a b c -> m (Loadable2 t PaymentPage)
+reducer :: forall t m a b c. MonadWidget t m => In t a b c -> m (Dynamic t (Loadable PaymentPage))
reducer input = do
postBuild <- R.getPostBuild
@@ -90,19 +91,13 @@ reducer input = do
getResult <- AjaxUtil.get (pageUrl <$> paramsEvent)
- isLoading <- R.holdDyn
- True
+ R.holdDyn
+ Loading
(R.leftmost
- [ True <$ paramsEvent
- , False <$ getResult
+ [ Loading <$ paramsEvent
+ , Loadable.fromEither <$> getResult
])
- paymentPage <- R.holdDyn
- Nothing
- (fmap EitherUtil.eitherToMaybe getResult)
-
- return $ Loadable2 isLoading paymentPage
-
where
pageUrl (Params page search frequency) =
"api/payments?page="