Skip to content

Commit

Permalink
don't dismiss modal after upgrade for approval case
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Oct 24, 2024
1 parent 866ce4b commit 1cd500e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,19 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) {
return;
}
switch (feature.id) {
case CONST.UPGRADE_FEATURE_INTRO_MAPPING.approvals.id:
Navigation.goBack();
if (route.params.backTo) {
Navigation.navigate(route.params.backTo);
}
return;
case CONST.UPGRADE_FEATURE_INTRO_MAPPING.reportFields.id:
case CONST.UPGRADE_FEATURE_INTRO_MAPPING.rules.id:
case CONST.UPGRADE_FEATURE_INTRO_MAPPING.companyCards.id:
Navigation.dismissModal();
return Navigation.navigate(ROUTES.WORKSPACE_MORE_FEATURES.getRoute(policyID));
default:
Navigation.dismissModal();
return route.params.backTo ? Navigation.navigate(route.params.backTo) : Navigation.goBack();
}
}, [feature, policyID, route.params.backTo]);
Expand All @@ -51,7 +59,7 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) {
return;
}

Policy.upgradeToCorporate(policy.id, feature.name);
Policy.upgradeToCorporate(policy.id, feature?.name);
};

const confirmUpgrade = useCallback(() => {
Expand Down Expand Up @@ -97,7 +105,6 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) {
title={translate('common.upgrade')}
onBackButtonPress={() => {
if (isUpgraded) {
Navigation.dismissModal();
goBack();
} else {
Navigation.goBack();
Expand All @@ -106,10 +113,7 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) {
/>
{isUpgraded && (
<UpgradeConfirmation
onConfirmUpgrade={() => {
Navigation.dismissModal();
goBack();
}}
onConfirmUpgrade={goBack}
policyName={policy.name}
/>
)}
Expand Down

0 comments on commit 1cd500e

Please sign in to comment.