diff options
Diffstat (limited to 'src/client/elm/Server.elm')
-rw-r--r-- | src/client/elm/Server.elm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client/elm/Server.elm b/src/client/elm/Server.elm index fd32cec..c017548 100644 --- a/src/client/elm/Server.elm +++ b/src/client/elm/Server.elm @@ -4,6 +4,7 @@ module Server exposing , editPayment , deletePayment , createIncome + , editIncome , deleteIncome , signOut ) @@ -66,6 +67,16 @@ createIncome amount date = |> HttpUtils.jsonRequest "POST" "/income" |> flip Task.andThen (HttpUtils.decodeHttpValue <| "id" := incomeIdDecoder) +editIncome : IncomeId -> Int -> Date -> Task Http.Error () +editIncome incomeId amount date = + Json.object + [ ("id", Json.int incomeId) + , ("amount", Json.int amount) + , ("date", Json.string (DateFormat.isoDateString date)) + ] + |> HttpUtils.jsonRequest "PUT" "/income" + |> Task.map (always ()) + deleteIncome : IncomeId -> Task Http.Error () deleteIncome incomeId = HttpUtils.request "DELETE" ("/income?id=" ++ (toString incomeId)) |