@@ -72,18 +72,22 @@ handleAction :: ∀ m. MonadAff m => Action -> HalogenM State Action ChildSlots
7272handleAction = case _ of
7373 FetchStuff -> do
7474 H .liftEffect $ log " handling action FetchStuff..."
75- invoicesEE <- H .liftAff $ DAO .listInvoices
76- invoicesEE # either (\e -> H .modify_ $ _ { status = ErrorStatus " Failed to fetch invoices." })
77- (either (\e -> H .modify_ $ _ { status = ErrorStatus " Decoding invoices failed." })
78- (\x -> H .modify_ $ _ { accounts = [ { invoices: x.data } ] }))
79- spyM " invoicesEE" $ invoicesEE
8075
76+ -- fetch the customer
8177 customerEE <- H .liftAff $ DAO .fetchCustomer
8278 customerEE # either (\e -> H .modify_ $ _ { customer = Nothing , status = ErrorStatus " Failed to fetch customer." })
8379 (either (\e -> H .modify_ $ _ { customer = Nothing , status = ErrorStatus " Decoding customer failed." })
8480 (\x -> H .modify_ $ _ { customer = Just x }))
8581 spyM " customerEE" $ customerEE
8682
83+ -- fetch some invoices for the customer
84+ invoicesEE <- H .liftAff $ DAO .listInvoices
85+ invoicesEE # either (\e -> H .modify_ $ _ { status = ErrorStatus " Failed to fetch invoices." })
86+ (either (\e -> H .modify_ $ _ { status = ErrorStatus " Decoding invoices failed." })
87+ (\x -> H .modify_ $ _ { accounts = [ { invoices: x.data } ] }))
88+ spyM " invoicesEE" $ invoicesEE
89+
90+ -- fetch the payment methods for this customer
8791 paymentMethodsEE <- H .liftAff $ DAO .listPaymentMethods
8892 paymentMethodsEE # either (\e -> H .modify_ $ _ { status = ErrorStatus " Failed to fetch payment methods." })
8993 (either (\e -> H .modify_ $ _ { status = ErrorStatus " Decoding payment methods failed." })
0 commit comments