Skip to content

Commit

Permalink
add fail support, show error from the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
waterim committed Sep 25, 2024
1 parent db8270e commit 4e330e0
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/pages/workspace/members/WorkspaceOwnerChangeWrapperPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function WorkspaceOwnerChangeWrapperPage({route, policy}: WorkspaceOwnerChangeWr
const policyID = route.params.policyID;
const accountID = route.params.accountID;
const error = route.params.error;
const shouldShowPaymentCardForm =
error === CONST.POLICY.OWNERSHIP_ERRORS.NO_BILLING_CARD || privateStripeCustomerID?.status === CONST.STRIPE_GBP_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED;
const isAuthRequired = privateStripeCustomerID?.status === CONST.STRIPE_GBP_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED;
const shouldShowPaymentCardForm = error === CONST.POLICY.OWNERSHIP_ERRORS.NO_BILLING_CARD || isAuthRequired;

useEffect(() => {
if (!policy || policy?.isLoading) {
Expand Down Expand Up @@ -76,16 +76,14 @@ function WorkspaceOwnerChangeWrapperPage({route, policy}: WorkspaceOwnerChangeWr
/>
<View style={[styles.containerWithSpaceBetween, error !== CONST.POLICY.OWNERSHIP_ERRORS.NO_BILLING_CARD ? styles.ph5 : styles.ph0, styles.pb0]}>
{policy?.isLoading && <FullScreenLoadingIndicator />}
{!policy?.isLoading &&
(shouldShowPaymentCardForm ? (
<WorkspaceOwnerPaymentCardForm policy={policy} />
) : (
<WorkspaceOwnerChangeCheck
policy={policy}
accountID={accountID}
error={error}
/>
))}
{shouldShowPaymentCardForm && <WorkspaceOwnerPaymentCardForm policy={policy} />}
{!policy?.isLoading && !shouldShowPaymentCardForm && (
<WorkspaceOwnerChangeCheck
policy={policy}
accountID={accountID}
error={error}
/>
)}
<CardAuthenticationModal
headerTitle={translate('subscription.authenticatePaymentCard')}
policyID={policyID}
Expand Down

0 comments on commit 4e330e0

Please sign in to comment.