Skip to content
10 changes: 10 additions & 0 deletions src/pages/workspace/taxes/WorkspaceEditTaxPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ function WorkspaceEditTaxPage({
Navigation.setParams({taxID: currentTaxID});
}, [taxID, currentTaxID]);

useEffect(() => {
if (currentTaxRate || !policy?.taxRates?.taxes) {
return;
}
Navigation.goBack(ROUTES.WORKSPACE_TAXES.getRoute(policyID));
}, [currentTaxRate, policy?.taxRates?.taxes, policyID]);

const deleteTaxRate = () => {
if (!policyID) {
return;
Expand All @@ -67,6 +74,9 @@ function WorkspaceEditTaxPage({
};

if (!currentTaxRate) {
if (policy?.taxRates?.taxes) {
return null;
}
return <NotFoundPage />;
}
const taxCodeToShow = isControlPolicy(policy) ? taxID : '';
Expand Down
Loading