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/Update | |
parent | 5bfd349bedb9c395cbeb38bb888e379ba36d5d35 (diff) |
Fetch all the payments, do the paging only in the UI
Diffstat (limited to 'src/client/elm/Update')
-rw-r--r-- | src/client/elm/Update/LoggedIn.elm | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/client/elm/Update/LoggedIn.elm b/src/client/elm/Update/LoggedIn.elm index 5292c25..2dc65c3 100644 --- a/src/client/elm/Update/LoggedIn.elm +++ b/src/client/elm/Update/LoggedIn.elm @@ -19,11 +19,11 @@ import Update.LoggedIn.Account as UA type LoggedAction = UpdateAdd AddPaymentAction | UpdatePayments Payments - | AddPayment UserId String Int Payments + | AddPayment UserId String Int | AddMonthlyPayment PaymentId String Int | ToggleEdit PaymentId - | DeletePayment Payment Payments - | UpdatePage Int Payments + | DeletePayment Payment + | UpdatePage Int | UpdateMonthly UM.MonthlyAction | UpdateAccount UA.AccountAction @@ -34,10 +34,9 @@ updateLoggedIn model action loggedInView = { loggedInView | add = updateAddPayment addPaymentAction loggedInView.add } UpdatePayments payments -> { loggedInView | payments = payments } - AddPayment userId name cost payments -> + AddPayment userId name cost -> { loggedInView - | payments = payments - , currentPage = 1 + | currentPage = 1 , add = initAddPayment Punctual , account = UA.updateAccount (UA.UpdatePayer userId model.currentTime cost) loggedInView.account , paymentsCount = loggedInView.paymentsCount + 1 @@ -51,16 +50,14 @@ updateLoggedIn model action loggedInView = } ToggleEdit id -> { loggedInView | paymentEdition = if loggedInView.paymentEdition == Just id then Nothing else Just id } - DeletePayment payment payments -> + DeletePayment payment -> { loggedInView - | payments = payments - , account = UA.updateAccount (UA.UpdatePayer payment.userId (Date.toTime payment.creation) -payment.cost) loggedInView.account + | account = UA.updateAccount (UA.UpdatePayer payment.userId (Date.toTime payment.creation) -payment.cost) loggedInView.account , paymentsCount = loggedInView.paymentsCount - 1 } - UpdatePage page payments -> + UpdatePage page -> { loggedInView | currentPage = page - , payments = payments } UpdateMonthly monthlyAction -> { loggedInView | monthly = UM.updateMonthly monthlyAction loggedInView.monthly } |