From 24633871359ec9fbd63fdfebf79a6351b2792f77 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 6 Sep 2015 00:05:50 +0200 Subject: Can add monthly payments, not visible at the moment though, just the count is printed --- src/client/ServerCommunication.elm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/client/ServerCommunication.elm') diff --git a/src/client/ServerCommunication.elm b/src/client/ServerCommunication.elm index c38805b..1f35fa1 100644 --- a/src/client/ServerCommunication.elm +++ b/src/client/ServerCommunication.elm @@ -13,6 +13,7 @@ import Date import Model.Message exposing (messageDecoder) import Model.User exposing (UserId) import Model.Payment exposing (PaymentId, perPage, paymentsDecoder) +import Model.View.Payment.Add exposing (Frequency) import Update as U import Update.SignIn exposing (..) @@ -21,7 +22,7 @@ import Update.Payment as UP type Communication = NoCommunication | SignIn String - | AddPayment UserId String Int + | AddPayment UserId String Int Frequency | DeletePayment PaymentId UserId Int Int | UpdatePage Int | SignOut @@ -45,8 +46,8 @@ getRequest communication = Nothing SignIn login -> Just (simple "post" ("/signIn?login=" ++ login)) - AddPayment userId paymentName cost -> - Just (simple "post" ("/payment/add?name=" ++ paymentName ++ "&cost=" ++ (toString cost))) + AddPayment userId paymentName cost frequency -> + Just (simple "post" ("/payment/add?name=" ++ paymentName ++ "&cost=" ++ (toString cost) ++ "&frequency=" ++ (toString frequency))) DeletePayment paymentId _ _ _ -> Just (simple "post" ("payment/delete?id=" ++ (toString paymentId))) UpdatePage page -> @@ -75,7 +76,7 @@ serverResult communication response = Task.succeed U.NoOp SignIn login -> Task.succeed (U.UpdateSignIn (ValidLogin login)) - AddPayment userId paymentName cost -> + AddPayment userId paymentName cost frequency -> Http.send Http.defaultSettings (updatePageRequest 1) |> Task.map (\response -> if response.status == 200 -- cgit v1.2.3