diff options
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) |