From a271d6034bc4cc631a64476d25d21c83a701fa39 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Mon, 20 Jul 2015 21:55:52 +0200 Subject: Add a payment from the UI, it needs polishing however --- src/client/Update.elm | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src/client/Update.elm') 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 } -- cgit v1.2.3