From 8816cf758119a6a2073e561c8df297a833630986 Mon Sep 17 00:00:00 2001 From: Joris Date: Mon, 8 Aug 2016 20:58:17 +0200 Subject: Show incomes in a table and update like payments are updated --- src/client/elm/Server.elm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/client/elm/Server.elm') 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)) -- cgit v1.2.3