diff options
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) |