aboutsummaryrefslogtreecommitdiff
path: root/src/client/Main.elm
diff options
context:
space:
mode:
authorJoris2015-09-03 23:32:39 +0200
committerJoris2015-09-03 23:32:39 +0200
commit889df8caf04de5f10a9e623bab3e502e9573159d (patch)
treed8c3dff55ffd38914543213e544c55e346e1f13e /src/client/Main.elm
parentebd304d97b612d0ac4ea276b1c29ba8ecc0b7998 (diff)
downloadbudget-889df8caf04de5f10a9e623bab3e502e9573159d.tar.gz
budget-889df8caf04de5f10a9e623bab3e502e9573159d.tar.bz2
budget-889df8caf04de5f10a9e623bab3e502e9573159d.zip
Give the payments count to the client
Diffstat (limited to 'src/client/Main.elm')
-rw-r--r--src/client/Main.elm7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/client/Main.elm b/src/client/Main.elm
index 57e41d4..6ca2743 100644
--- a/src/client/Main.elm
+++ b/src/client/Main.elm
@@ -9,7 +9,7 @@ import Html exposing (Html)
import Http
import Task exposing (..)
import Time exposing (..)
-import Json.Decode as Json
+import Json.Decode as Json exposing ((:=))
import Model exposing (Model, initialModel)
import Model.Payment exposing (Payments, paymentsDecoder)
@@ -56,7 +56,7 @@ port initView =
Just msg ->
Signal.send actions.address (SignInError msg)
Nothing ->
- Task.map3 GoPaymentView getUserName getPayments getPayers
+ Task.map4 GoPaymentView getUserName getPayments getPaymentsCount getPayers
|> flip Task.andThen (Signal.send actions.address)
|> flip Task.onError (\_ -> Signal.send actions.address GoSignInView)
@@ -66,6 +66,9 @@ getUserName = Http.get messageDecoder "/userName"
getPayments : Task Http.Error Payments
getPayments = Http.get paymentsDecoder "/payments"
+getPaymentsCount : Task Http.Error Int
+getPaymentsCount = Http.get ("number" := Json.int) "/payments/count"
+
getPayers : Task Http.Error Payers
getPayers = Http.get payersDecoder "/payments/total"