diff options
author | Joris | 2016-01-04 00:34:48 +0100 |
---|---|---|
committer | Joris | 2016-01-04 00:40:25 +0100 |
commit | 6b090b3bdef7108d51d93207e28b148c121767aa (patch) | |
tree | f0815d638723b62b5f16cf9d94ce5783751fc3db /src/client/elm/Model | |
parent | d9df5c3fcffe12aac239b58ccf2fd82c19c3be62 (diff) |
Simplify server communicaitons in client
Diffstat (limited to 'src/client/elm/Model')
-rw-r--r-- | src/client/elm/Model/Action.elm | 6 | ||||
-rw-r--r-- | src/client/elm/Model/Init.elm | 16 | ||||
-rw-r--r-- | src/client/elm/Model/View/LoggedInView.elm | 15 |
3 files changed, 26 insertions, 11 deletions
diff --git a/src/client/elm/Model/Action.elm b/src/client/elm/Model/Action.elm index 7267259..60c1aca 100644 --- a/src/client/elm/Model/Action.elm +++ b/src/client/elm/Model/Action.elm @@ -5,17 +5,15 @@ module Model.Action import Time exposing (Time) import Signal exposing (Address) -import Model.User exposing (Users, UserId) -import Model.Payment exposing (Payments) -import Model.Payer exposing (Payers) import Model.Action.SignInAction exposing (SignInAction) import Model.Action.LoggedInAction exposing (LoggedInAction) +import Model.Init exposing (Init) type Action = NoOp | SignIn String | UpdateTime Time - | GoLoggedInView Users UserId Payments Payments Int Payers + | GoLoggedInView Init | UpdateSignIn SignInAction | UpdateLoggedIn LoggedInAction | GoSignInView diff --git a/src/client/elm/Model/Init.elm b/src/client/elm/Model/Init.elm new file mode 100644 index 0000000..490321b --- /dev/null +++ b/src/client/elm/Model/Init.elm @@ -0,0 +1,16 @@ +module Model.Init + ( Init + ) where + +import Model.Payment exposing (Payments) +import Model.Payer exposing (Payers) +import Model.User exposing (Users, UserId) + +type alias Init = + { users : Users + , me : UserId + , payments : Payments + , monthlyPayments : Payments + , paymentsCount : Int + , payers : Payers + } diff --git a/src/client/elm/Model/View/LoggedInView.elm b/src/client/elm/Model/View/LoggedInView.elm index 75285b1..2df3525 100644 --- a/src/client/elm/Model/View/LoggedInView.elm +++ b/src/client/elm/Model/View/LoggedInView.elm @@ -6,6 +6,7 @@ module Model.View.LoggedInView import Model.User exposing (Users, UserId) import Model.Payment exposing (Payments, PaymentFrequency(..)) import Model.Payer exposing (Payers) +import Model.Init exposing (..) import Model.View.LoggedIn.AddPayment exposing (..) import Model.View.LoggedIn.Edition exposing (..) import Model.View.LoggedIn.Monthly exposing (..) @@ -22,14 +23,14 @@ type alias LoggedInView = , currentPage : Int } -initLoggedInView : Users -> UserId -> Payments -> Payments -> Int -> Payers -> LoggedInView -initLoggedInView users me monthlyPayments payments paymentsCount payers = - { users = users +initLoggedInView : Init -> LoggedInView +initLoggedInView init = + { users = init.users , add = initAddPayment Punctual - , monthly = initMonthly monthlyPayments - , account = initAccount me payers - , payments = payments - , paymentsCount = paymentsCount + , monthly = initMonthly init.monthlyPayments + , account = initAccount init.me init.payers + , payments = init.payments + , paymentsCount = init.paymentsCount , paymentEdition = Nothing , currentPage = 1 } |