From 2a53fe50c62d4b7aec0f422998c743f68aa523c1 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Tue, 21 Jul 2015 23:25:58 +0200 Subject: Adding the payment without reloading the page --- src/client/Update.elm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/client/Update.elm') diff --git a/src/client/Update.elm b/src/client/Update.elm index f88a3a2..be7538a 100644 --- a/src/client/Update.elm +++ b/src/client/Update.elm @@ -4,6 +4,8 @@ module Update , updateModel ) where +import Time exposing (Time) + import Model exposing (Model) import Model.Payment exposing (Payments) import Model.View as V @@ -15,10 +17,11 @@ import Update.Payment exposing (..) type Action = NoOp + | UpdateTime Time | GoSignInView | SignInError String | UpdateSignIn SignInAction - | GoPaymentView Payments + | GoPaymentView String Payments | UpdatePayment PaymentAction actions : Signal.Mailbox Action @@ -29,10 +32,12 @@ updateModel action model = case action of NoOp -> model + UpdateTime time -> + { model | currentTime <- time } GoSignInView -> { model | view <- V.SignInView initSignInView } - GoPaymentView payments -> - { model | view <- V.PaymentView (initPaymentView payments) } + GoPaymentView userName payments -> + { model | view <- V.PaymentView (initPaymentView userName payments) } SignInError msg -> let signInView = { initSignInView | result <- Just (Err msg) } in { model | view <- V.SignInView signInView } @@ -45,6 +50,6 @@ updateModel action model = UpdatePayment paymentAction -> case model.view of V.PaymentView paymentView -> - { model | view <- V.PaymentView (updatePayment paymentAction paymentView) } + { model | view <- V.PaymentView (updatePayment model paymentAction paymentView) } _ -> model -- cgit v1.2.3