aboutsummaryrefslogtreecommitdiff
path: root/src/client/Update.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Update.elm')
-rw-r--r--src/client/Update.elm33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/client/Update.elm b/src/client/Update.elm
index 508ee2f..f88a3a2 100644
--- a/src/client/Update.elm
+++ b/src/client/Update.elm
@@ -6,17 +6,20 @@ module Update
import Model exposing (Model)
import Model.Payment exposing (Payments)
-import Model.View exposing (..)
-import Model.View.SignIn exposing (..)
+import Model.View as V
+import Model.View.SignInView exposing (..)
+import Model.View.PaymentView exposing (..)
import Update.SignIn exposing (..)
+import Update.Payment exposing (..)
type Action =
NoOp
- | SignIn
+ | GoSignInView
| SignInError String
| UpdateSignIn SignInAction
- | UpdatePayments Payments
+ | GoPaymentView Payments
+ | UpdatePayment PaymentAction
actions : Signal.Mailbox Action
actions = Signal.mailbox NoOp
@@ -26,16 +29,22 @@ updateModel action model =
case action of
NoOp ->
model
- SignIn ->
- { model | view <- SignInView initSignIn }
+ GoSignInView ->
+ { model | view <- V.SignInView initSignInView }
+ GoPaymentView payments ->
+ { model | view <- V.PaymentView (initPaymentView payments) }
SignInError msg ->
- let signIn = { initSignIn | result <- Just (Err msg) }
- in { model | view <- SignInView signIn }
+ let signInView = { initSignInView | result <- Just (Err msg) }
+ in { model | view <- V.SignInView signInView }
UpdateSignIn signInAction ->
case model.view of
- SignInView signIn ->
- { model | view <- SignInView (updateSignIn signInAction signIn) }
+ V.SignInView signInView ->
+ { model | view <- V.SignInView (updateSignIn signInAction signInView) }
+ _ ->
+ model
+ UpdatePayment paymentAction ->
+ case model.view of
+ V.PaymentView paymentView ->
+ { model | view <- V.PaymentView (updatePayment paymentAction paymentView) }
_ ->
model
- UpdatePayments payments ->
- { model | view <- PaymentView payments }