diff options
author | Joris | 2015-09-05 13:53:36 +0200 |
---|---|---|
committer | Joris | 2015-09-05 13:53:36 +0200 |
commit | 3b738e0d4cc65f314da7389d4542ec826ba0f454 (patch) | |
tree | ee99236117ad698974c5a6e40ab170f617cb06f3 /src/client/Main.elm | |
parent | 139d4a103a6a48880e5f12a796033956f223563c (diff) |
Using UserId instead of UserName to indentify users
Diffstat (limited to 'src/client/Main.elm')
-rw-r--r-- | src/client/Main.elm | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/Main.elm b/src/client/Main.elm index 685d3b2..07f8294 100644 --- a/src/client/Main.elm +++ b/src/client/Main.elm @@ -12,6 +12,7 @@ import Time exposing (..) import Json.Decode as Json exposing ((:=)) import Model exposing (Model, initialModel) +import Model.User exposing (Users, usersDecoder, UserId, userIdDecoder) import Model.Payment exposing (Payments, paymentsDecoder, perPage) import Model.Payers exposing (Payers, payersDecoder) import Model.Message exposing (messageDecoder) @@ -56,12 +57,15 @@ port initView = Just msg -> Signal.send actions.address (SignInError msg) Nothing -> - Task.map4 GoPaymentView getUserName getPayments getPaymentsCount getPayers + Task.map5 GoPaymentView getUsers whoAmI getPayments getPaymentsCount getPayers |> flip Task.andThen (Signal.send actions.address) |> flip Task.onError (\_ -> Signal.send actions.address GoSignInView) -getUserName : Task Http.Error String -getUserName = Http.get messageDecoder "/userName" +getUsers : Task Http.Error Users +getUsers = Http.get usersDecoder "/users" + +whoAmI : Task Http.Error UserId +whoAmI = Http.get ("id" := userIdDecoder) "/whoAmI" getPayments : Task Http.Error Payments getPayments = Http.get paymentsDecoder ("/payments?page=1&perPage=" ++ toString perPage) |