aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/ServerCommunication.elm
diff options
context:
space:
mode:
authorJoris2016-01-02 22:45:20 +0100
committerJoris2016-01-02 22:45:20 +0100
commitfc9a3ca6a5226f78a3a0ec51af3d8d287ccb2e1b (patch)
treee05a710b30f749048bb668db1501d2369fa4e666 /src/client/elm/ServerCommunication.elm
parent25d15aacb940c2a19cae3b2e3d8d3ebd1972be02 (diff)
downloadbudget-fc9a3ca6a5226f78a3a0ec51af3d8d287ccb2e1b.tar.gz
budget-fc9a3ca6a5226f78a3a0ec51af3d8d287ccb2e1b.tar.bz2
budget-fc9a3ca6a5226f78a3a0ec51af3d8d287ccb2e1b.zip
Merge deletePayment with deleteMonthlyPayment
Diffstat (limited to 'src/client/elm/ServerCommunication.elm')
-rw-r--r--src/client/elm/ServerCommunication.elm13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/client/elm/ServerCommunication.elm b/src/client/elm/ServerCommunication.elm
index 1cabda5..53612d8 100644
--- a/src/client/elm/ServerCommunication.elm
+++ b/src/client/elm/ServerCommunication.elm
@@ -18,8 +18,7 @@ import Model.Action as U exposing (Action)
import Model.Action.LoggedInAction as UL
import Model.Action.MonthlyAction as UM
import Model.Action.AccountAction as UA
-import Model.View.LoggedIn.AddPayment exposing (Frequency(..))
-import Model.Payment exposing (PaymentId, paymentIdDecoder, Payments, paymentsDecoder)
+import Model.Payment exposing (..)
import Model.Payer exposing (Payers, payersDecoder)
import Model.User exposing (Users, usersDecoder, UserId, userIdDecoder)
@@ -38,13 +37,9 @@ sendRequest communication =
|> flip Task.andThen (decodeHttpValue <| "id" := paymentIdDecoder)
|> Task.map (\paymentId -> (U.UpdateLoggedIn (UL.AddPayment paymentId name cost frequency)))
- DeletePayment payment currentPage ->
+ DeletePayment payment frequency ->
post (deletePaymentURL payment.id)
- |> Task.map (always (U.UpdateLoggedIn (UL.DeletePayment payment)))
-
- DeleteMonthlyPayment id ->
- post (deletePaymentURL id)
- |> Task.map (always (U.UpdateLoggedIn (UL.UpdateMonthly (UM.DeletePayment id))))
+ |> Task.map (always (U.UpdateLoggedIn (UL.DeletePayment payment frequency)))
SetIncome currentTime amount ->
post ("/income?amount=" ++ (toString amount))
@@ -54,7 +49,7 @@ sendRequest communication =
post "/signOut"
|> Task.map (always U.GoSignInView)
-addPaymentURL : String -> Int -> Frequency -> String
+addPaymentURL : String -> Int -> PaymentFrequency -> String
addPaymentURL name cost frequency =
"/payment/add?name=" ++ name ++ "&cost=" ++ (toString cost) ++ "&frequency=" ++ (toString frequency)