From b73ba24f3440b81698c9d5c370739d03f958f059 Mon Sep 17 00:00:00 2001 From: Joris Date: Thu, 31 Dec 2015 19:34:29 +0100 Subject: Fetch all the payments, do the paging only in the UI --- src/client/elm/ServerCommunication.elm | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/client/elm/ServerCommunication.elm') diff --git a/src/client/elm/ServerCommunication.elm b/src/client/elm/ServerCommunication.elm index 3ecfc3b..390bcfd 100644 --- a/src/client/elm/ServerCommunication.elm +++ b/src/client/elm/ServerCommunication.elm @@ -36,7 +36,6 @@ type Communication = | SetIncome Time Int | DeletePayment Payment Int | DeleteMonthlyPayment PaymentId - | UpdatePage Int | SignOut serverCommunications : Signal.Mailbox Communication @@ -59,8 +58,7 @@ sendRequest communication = AddPayment userId name cost -> post (addPaymentURL name cost Punctual) - |> flip Task.andThen (always (getPaymentsAtPage 1)) - |> Task.map (\payments -> U.UpdateLoggedIn (UL.AddPayment userId name cost payments)) + |> Task.map (always (U.UpdateLoggedIn (UL.AddPayment userId name cost))) AddMonthlyPayment name cost -> post (addPaymentURL name cost Monthly) @@ -69,17 +67,12 @@ sendRequest communication = DeletePayment payment currentPage -> post (deletePaymentURL payment.id) - |> flip Task.andThen (always (getPaymentsAtPage currentPage)) - |> Task.map (\payments -> U.UpdateLoggedIn (UL.DeletePayment payment payments)) + |> Task.map (always (U.UpdateLoggedIn (UL.DeletePayment payment))) DeleteMonthlyPayment id -> post (deletePaymentURL id) |> Task.map (always (U.UpdateLoggedIn (UL.UpdateMonthly (UM.DeletePayment id)))) - UpdatePage page -> - getPaymentsAtPage page - |> flip Task.andThen (Task.succeed << U.UpdateLoggedIn << UL.UpdatePage page) - SetIncome currentTime amount -> post ("/income?amount=" ++ (toString amount)) |> Task.map (always (U.UpdateLoggedIn (UL.UpdateAccount (UA.UpdateIncome currentTime amount)))) @@ -88,10 +81,6 @@ sendRequest communication = post "/signOut" |> Task.map (always U.GoSignInView) -getPaymentsAtPage : Int -> Task Http.Error Payments -getPaymentsAtPage page = - Http.get paymentsDecoder ("payments?page=" ++ toString page ++ "&perPage=" ++ toString perPage) - addPaymentURL : String -> Int -> Frequency -> String addPaymentURL name cost frequency = "/payment/add?name=" ++ name ++ "&cost=" ++ (toString cost) ++ "&frequency=" ++ (toString frequency) -- cgit v1.2.3