Skip to content

Commit

Permalink
Don't call api if no changes were made to tax name
Browse files Browse the repository at this point in the history
  • Loading branch information
allgandalf committed Jun 2, 2024
1 parent 041ffa5 commit ac1dc11
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pages/workspace/taxes/NamePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ function NamePage({
const goBack = useCallback(() => Navigation.goBack(ROUTES.WORKSPACE_TAX_EDIT.getRoute(policyID ?? '', taxID)), [policyID, taxID]);

const submit = () => {
renamePolicyTax(policyID, taxID, name);
const taxName = name.trim();
// Do not call the API if the edited tax name is the same as the current tag name
if (currentTaxRate?.name !== taxName) {
renamePolicyTax(policyID, taxID, taxName);
}
goBack();
};

Expand Down

0 comments on commit ac1dc11

Please sign in to comment.