diff options
author | Joris | 2016-01-01 13:00:51 +0100 |
---|---|---|
committer | Joris | 2016-01-01 13:00:51 +0100 |
commit | 5f3d75406ef36924616e3289342647f4939d5004 (patch) | |
tree | e19bfce420ef53ee93548f2e0ee1e248b7630e89 /src/client/elm/ServerCommunication.elm | |
parent | b73ba24f3440b81698c9d5c370739d03f958f059 (diff) |
Fix add and delete payment
Diffstat (limited to 'src/client/elm/ServerCommunication.elm')
-rw-r--r-- | src/client/elm/ServerCommunication.elm | 7 |
1 files changed, 4 insertions, 3 deletions
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) |