aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/ServerCommunication.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/ServerCommunication.elm')
-rw-r--r--src/client/elm/ServerCommunication.elm15
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)