diff options
Diffstat (limited to 'src/client/elm/ServerCommunication.elm')
-rw-r--r-- | src/client/elm/ServerCommunication.elm | 13 |
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) |