From 6b00a1530a140f7388e93efcf0daa6bbf202a721 Mon Sep 17 00:00:00 2001 From: "Georgi Malkhasyan (CW)" Date: Wed, 4 Dec 2024 13:09:42 -0800 Subject: [PATCH] update the state in the main traid --- .../PayPalWebViewModel/PayPalWebViewModel.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Demo/Demo/PayPalWebPayments/PayPalWebViewModel/PayPalWebViewModel.swift b/Demo/Demo/PayPalWebPayments/PayPalWebViewModel/PayPalWebViewModel.swift index c4042cd8..64ca48ef 100644 --- a/Demo/Demo/PayPalWebPayments/PayPalWebViewModel/PayPalWebViewModel.swift +++ b/Demo/Demo/PayPalWebPayments/PayPalWebViewModel/PayPalWebViewModel.swift @@ -65,7 +65,9 @@ class PayPalWebViewModel: ObservableObject { func captureOrder(orderID: String, selectedMerchantIntegration: MerchantIntegration) async { do { - self.state.capturedOrderResponse = .loading + DispatchQueue.main.async { + self.state.capturedOrderResponse = .loading + } let payPalClientMetadataID = payPalDataCollector?.collectDeviceData() let order = try await DemoMerchantAPI.sharedService.captureOrder( orderID: orderID, @@ -162,8 +164,9 @@ class PayPalWebViewModel: ObservableObject { func completeTransaction() async throws { do { - self.state.authorizedOrderResponse = .loading - + DispatchQueue.main.async { + self.state.authorizedOrderResponse = .loading + } let payPalClientMetadataID = payPalDataCollector?.collectDeviceData() if let orderID { let order = try await DemoMerchantAPI.sharedService.completeOrder(