diff options
author | Joris | 2019-10-20 22:08:31 +0200 |
---|---|---|
committer | Joris | 2019-10-20 22:08:31 +0200 |
commit | 33e78f2ebbf5bf7b40e7aa732cc7c019f6df3f12 (patch) | |
tree | bc325950963bcb5c27e1aaba2a4ee7e092efbcd4 /client/src/Util | |
parent | 602c52acfcfa494b07fec05c20b317b60ea8a6f3 (diff) |
Simplify page initialization
Diffstat (limited to 'client/src/Util')
-rw-r--r-- | client/src/Util/Ajax.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/client/src/Util/Ajax.hs b/client/src/Util/Ajax.hs index 9cd5105..47f4f3c 100644 --- a/client/src/Util/Ajax.hs +++ b/client/src/Util/Ajax.hs @@ -1,5 +1,6 @@ module Util.Ajax - ( get + ( getNow + , get , post , put , delete @@ -21,6 +22,14 @@ import Reflex.Dom (Dynamic, Event, IsXhrPayload, XhrResponseHeaders (..)) import qualified Reflex.Dom as R +import Loadable (Loadable) +import qualified Loadable + +getNow :: forall t m a. (MonadWidget t m, FromJSON a) => Text -> m (Dynamic t (Loadable a)) +getNow url = do + postBuild <- R.getPostBuild + get (R.tag (R.constant url) postBuild) >>= Loadable.fromEvent + get :: forall t m a. (MonadWidget t m, FromJSON a) => Event t Text |