diff options
author | Joris | 2015-12-31 19:34:29 +0100 |
---|---|---|
committer | Joris | 2015-12-31 19:34:29 +0100 |
commit | b73ba24f3440b81698c9d5c370739d03f958f059 (patch) | |
tree | 72caa19d605d9e9af2d43a6f62c177ddb3d0f3b3 /src/client/elm/ServerCommunication.elm | |
parent | 5bfd349bedb9c395cbeb38bb888e379ba36d5d35 (diff) |
Fetch all the payments, do the paging only in the UI
Diffstat (limited to 'src/client/elm/ServerCommunication.elm')
-rw-r--r-- | src/client/elm/ServerCommunication.elm | 15 |
1 files changed, 2 insertions, 13 deletions
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) |