aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/ServerCommunication.elm
diff options
context:
space:
mode:
authorJoris2016-01-01 13:00:51 +0100
committerJoris2016-01-01 13:00:51 +0100
commit5f3d75406ef36924616e3289342647f4939d5004 (patch)
treee19bfce420ef53ee93548f2e0ee1e248b7630e89 /src/client/elm/ServerCommunication.elm
parentb73ba24f3440b81698c9d5c370739d03f958f059 (diff)
downloadbudget-5f3d75406ef36924616e3289342647f4939d5004.tar.gz
budget-5f3d75406ef36924616e3289342647f4939d5004.tar.bz2
budget-5f3d75406ef36924616e3289342647f4939d5004.zip
Fix add and delete payment
Diffstat (limited to 'src/client/elm/ServerCommunication.elm')
-rw-r--r--src/client/elm/ServerCommunication.elm7
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)