From fc9a3ca6a5226f78a3a0ec51af3d8d287ccb2e1b Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 2 Jan 2016 22:45:20 +0100 Subject: Merge deletePayment with deleteMonthlyPayment --- src/client/elm/ServerCommunication.elm | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/client/elm/ServerCommunication.elm') 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) -- cgit v1.2.3