From 5f3d75406ef36924616e3289342647f4939d5004 Mon Sep 17 00:00:00 2001 From: Joris Date: Fri, 1 Jan 2016 13:00:51 +0100 Subject: Fix add and delete payment --- src/client/elm/ServerCommunication.elm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/client/elm/ServerCommunication.elm') diff --git a/src/client/elm/ServerCommunication.elm b/src/client/elm/ServerCommunication.elm index 390bcfd..74b45e8 100644 --- a/src/client/elm/ServerCommunication.elm +++ b/src/client/elm/ServerCommunication.elm @@ -31,7 +31,7 @@ import InitViewAction exposing (initViewAction) type Communication = NoCommunication | SignIn String - | AddPayment UserId String Int + | AddPayment String Int | AddMonthlyPayment String Int | SetIncome Time Int | DeletePayment Payment Int @@ -56,9 +56,10 @@ sendRequest communication = |> flip Task.andThen (always <| Task.fail err) ) - AddPayment userId name cost -> + AddPayment name cost -> post (addPaymentURL name cost Punctual) - |> Task.map (always (U.UpdateLoggedIn (UL.AddPayment userId name cost))) + |> flip Task.andThen (decodeHttpValue <| "id" := paymentIdDecoder) + |> Task.map (\paymentId -> (U.UpdateLoggedIn (UL.AddPayment paymentId name cost))) AddMonthlyPayment name cost -> post (addPaymentURL name cost Monthly) -- cgit v1.2.3