From 182f3d3fea9985c0e403087fe253981c68e57102 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 3 Nov 2019 11:33:20 +0100 Subject: Fix payment page --- client/src/View/Payment/Payment.hs | 2 +- server/src/Controller/Income.hs | 7 +++++++ server/src/Main.hs | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/src/View/Payment/Payment.hs b/client/src/View/Payment/Payment.hs index f86acd8..e72577f 100644 --- a/client/src/View/Payment/Payment.hs +++ b/client/src/View/Payment/Payment.hs @@ -29,7 +29,7 @@ init :: forall t m. MonadWidget t m => m (Dynamic t (Loadable Init)) init = do users <- AjaxUtil.getNow "api/users" payments <- AjaxUtil.getNow "api/payments" - incomes <- AjaxUtil.getNow "api/incomes" + incomes <- AjaxUtil.getNow "api/deprecated/incomes" categories <- AjaxUtil.getNow "api/categories" paymentCategories <- AjaxUtil.getNow "api/paymentCategories" return $ do diff --git a/server/src/Controller/Income.hs b/server/src/Controller/Income.hs index d8d3d89..4a41bd3 100644 --- a/server/src/Controller/Income.hs +++ b/server/src/Controller/Income.hs @@ -1,5 +1,6 @@ module Controller.Income ( list + , deprecatedList , create , edit , delete @@ -58,6 +59,12 @@ list page perPage = return $ IncomePage (IncomeHeader since byUser) incomes count) >>= json ) +deprecatedList :: ActionM () +deprecatedList = + Secure.loggedAction (\_ -> + (liftIO . Query.run $ IncomePersistence.listAll) >>= json + ) + create :: CreateIncomeForm -> ActionM () create form = Secure.loggedAction (\user -> diff --git a/server/src/Main.hs b/server/src/Main.hs index 40b53b6..b2672e4 100644 --- a/server/src/Main.hs +++ b/server/src/Main.hs @@ -59,6 +59,9 @@ main = do perPage <- S.param "perPage" Income.list page perPage + S.get "/api/deprecated/incomes" $ do + Income.deprecatedList + S.post "/api/income" $ S.jsonData >>= Income.create -- cgit v1.2.3