diff options
author | Joris | 2015-09-06 00:05:50 +0200 |
---|---|---|
committer | Joris | 2015-09-06 00:05:50 +0200 |
commit | 24633871359ec9fbd63fdfebf79a6351b2792f77 (patch) | |
tree | a87c8a964a3c5114da13e622c604cf99ab905a06 /src/client/Main.elm | |
parent | 8c328987901973cd0ffd2e03cae547717ebbbc67 (diff) |
Can add monthly payments, not visible at the moment though, just the count is printed
Diffstat (limited to 'src/client/Main.elm')
-rw-r--r-- | src/client/Main.elm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/client/Main.elm b/src/client/Main.elm index 368d930..3174ba6 100644 --- a/src/client/Main.elm +++ b/src/client/Main.elm @@ -57,9 +57,14 @@ port initView = Just msg -> Signal.send actions.address (SignInError msg) Nothing -> - Task.map5 GoLoggedView getUsers whoAmI getPayments getPaymentsCount getPayers - |> flip Task.andThen (Signal.send actions.address) - |> flip Task.onError (\_ -> Signal.send actions.address GoSignInView) + Task.andThen getUsers <| \users -> + Task.andThen whoAmI <| \me -> + Task.andThen getMonthlyPayments <| \monthlyPayments -> + Task.andThen getPayments <| \payments -> + Task.andThen getPaymentsCount <| \paymentsCount -> + Task.andThen getPayers <| \payers -> + Signal.send actions.address (GoLoggedView users me monthlyPayments payments paymentsCount payers) + |> flip Task.onError (\_ -> Signal.send actions.address GoSignInView) getUsers : Task Http.Error Users getUsers = Http.get usersDecoder "/users" @@ -67,6 +72,9 @@ getUsers = Http.get usersDecoder "/users" whoAmI : Task Http.Error UserId whoAmI = Http.get ("id" := userIdDecoder) "/whoAmI" +getMonthlyPayments : Task Http.Error Payments +getMonthlyPayments = Http.get paymentsDecoder "/monthlyPayments" + getPayments : Task Http.Error Payments getPayments = Http.get paymentsDecoder ("/payments?page=1&perPage=" ++ toString perPage) |