diff options
Diffstat (limited to 'client/src/View/Income')
| -rw-r--r-- | client/src/View/Income/Income.hs | 2 | ||||
| -rw-r--r-- | client/src/View/Income/Reducer.hs | 19 | 
2 files changed, 8 insertions, 13 deletions
diff --git a/client/src/View/Income/Income.hs b/client/src/View/Income/Income.hs index fa2585d..e83ba80 100644 --- a/client/src/View/Income/Income.hs +++ b/client/src/View/Income/Income.hs @@ -50,7 +50,7 @@ view input = do      editIncome <- eventFromResult $ Table._out_edit . (\(_, b, _) -> b)      deleteIncome <- eventFromResult $ Table._out_delete . (\(_, b, _) -> b) -    result <- Loadable.view2 incomePage $ +    result <- Loadable.viewShowValueWhileLoading incomePage $        \(IncomePage page header incomes count) -> do          header <- Header.view $ Header.In            { Header._in_users = _in_users input diff --git a/client/src/View/Income/Reducer.hs b/client/src/View/Income/Reducer.hs index 391890f..ea9f664 100644 --- a/client/src/View/Income/Reducer.hs +++ b/client/src/View/Income/Reducer.hs @@ -11,7 +11,8 @@ import qualified Reflex.Dom   as R  import           Common.Model (IncomePage) -import           Loadable     (Loadable2 (..)) +import           Loadable     (Loadable (..)) +import qualified Loadable     as Loadable  import qualified Util.Ajax    as AjaxUtil  import qualified Util.Either  as EitherUtil @@ -25,7 +26,7 @@ data In t a b c = In    , _in_deleteIncome :: Event t c    } -reducer :: forall t m a b c. MonadWidget t m => In t a b c -> m (Loadable2 t IncomePage) +reducer :: forall t m a b c. MonadWidget t m => In t a b c -> m (Dynamic t (Loadable IncomePage))  reducer input = do    postBuild <- R.getPostBuild @@ -43,19 +44,13 @@ reducer input = do    getResult <- AjaxUtil.get $ fmap pageUrl loadPage -  isLoading <- R.holdDyn -    True +  R.holdDyn +    Loading      (R.leftmost -      [ True <$ loadPage -      , False <$ getResult +      [ Loading <$ loadPage +      , Loadable.fromEither <$> getResult        ]) -  incomePage <- R.holdDyn -    Nothing -    (fmap EitherUtil.eitherToMaybe getResult) - -  return $ Loadable2 isLoading incomePage -    where      pageUrl p =        "api/incomes?page="  | 
