From 869bab77e93e2a6c776a4b1fc35ef0fd5df22f5f Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 27 Mar 2016 17:36:33 +0200 Subject: Compute payers client side rather than server side --- src/client/elm/Server.elm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/client/elm/Server.elm') diff --git a/src/client/elm/Server.elm b/src/client/elm/Server.elm index c1fb445..314ca01 100644 --- a/src/client/elm/Server.elm +++ b/src/client/elm/Server.elm @@ -17,7 +17,7 @@ import Time exposing (Time) import Utils.Http exposing (..) import Model.Payment exposing (..) -import Model.Payer exposing (Payers, payersDecoder) +import Model.Income exposing (incomesDecoder, incomeIdDecoder, IncomeId) import Model.User exposing (Users, usersDecoder, UserId, userIdDecoder) import Model.Init exposing (Init) @@ -28,7 +28,7 @@ init = `Task.andMap` (Http.get paymentsDecoder "/payments") `Task.andMap` (Http.get paymentsDecoder "/monthlyPayments") `Task.andMap` (Http.get ("number" := Json.int) "/payments/count") - `Task.andMap` (Http.get payersDecoder "/payers") + `Task.andMap` (Http.get incomesDecoder "/incomes") signIn : String -> Task Http.Error () signIn email = @@ -45,10 +45,10 @@ deletePayment payment frequency = post ("payment/delete?id=" ++ (toString payment.id)) |> Task.map (always ()) -setIncome : Time -> Int -> Task Http.Error () +setIncome : Time -> Int -> Task Http.Error IncomeId setIncome currentTime amount = post ("/income?amount=" ++ (toString amount)) - |> Task.map (always ()) + |> flip Task.andThen (decodeHttpValue <| "id" := incomeIdDecoder) signOut : Task Http.Error () signOut = -- cgit v1.2.3