diff options
author | Joris | 2015-12-29 22:38:42 +0100 |
---|---|---|
committer | Joris | 2015-12-29 22:38:42 +0100 |
commit | a7db22556b91bc7c499e010b4c051f4442ad8ce2 (patch) | |
tree | 9f991523cee681bf179c191260b95672f1c44def /src/client/elm/InitViewAction.elm | |
parent | c79fa3e212e8bb49f950da3c3218e32e3b9df2ec (diff) |
Using persona to validate emails
Diffstat (limited to 'src/client/elm/InitViewAction.elm')
-rw-r--r-- | src/client/elm/InitViewAction.elm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/client/elm/InitViewAction.elm b/src/client/elm/InitViewAction.elm new file mode 100644 index 0000000..7c353a7 --- /dev/null +++ b/src/client/elm/InitViewAction.elm @@ -0,0 +1,25 @@ +module InitViewAction + ( initViewAction + ) where + +import Task exposing (..) +import Http +import Json.Decode as Json exposing ((:=)) + +import Update exposing (Action(GoLoggedInView, GoSignInView)) + +import Model.Payment exposing (Payments, paymentsDecoder, perPage) +import Model.Payer exposing (Payers, payersDecoder) +import Model.User exposing (Users, usersDecoder, UserId, userIdDecoder) + +initViewAction : Task Http.Error Action +initViewAction = Task.onError loggedInView (always <| Task.succeed GoSignInView) + +loggedInView : Task Http.Error Action +loggedInView = + Task.map GoLoggedInView (Http.get usersDecoder "/users") + `Task.andMap` (Http.get ("id" := userIdDecoder) "/whoAmI") + `Task.andMap` (Http.get paymentsDecoder "/monthlyPayments") + `Task.andMap` (Http.get paymentsDecoder ("/payments?page=1&perPage=" ++ toString perPage)) + `Task.andMap` (Http.get ("number" := Json.int) "/payments/count") + `Task.andMap` (Http.get payersDecoder "/payers") |