Skip to content

Commit

Permalink
refactor conditional to return early
Browse files Browse the repository at this point in the history
  • Loading branch information
ishpaul777 committed Mar 13, 2024
1 parent 0a71129 commit 56f259c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/pages/workspace/workflows/WorkspaceWorkflowsPayerPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,11 @@ function WorkspaceWorkflowsPayerPage({route, policy, policyMembers, personalDeta
const setPolicyAuthorizedPayer = (member: MemberOption) => {
const authorizedPayerEmail = personalDetails?.[member.accountID]?.login ?? '';

if (policy?.reimburserEmail === authorizedPayerEmail) {
if (policy?.reimburserEmail === authorizedPayerEmail || policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES) {
Navigation.goBack();
return;
}

if (policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES) {
return;
}
const authorizedPayerAccountID = member.accountID;
Policy.setWorkspacePayer(policy?.id ?? '', authorizedPayerEmail, authorizedPayerAccountID);
Navigation.goBack();
Expand Down

0 comments on commit 56f259c

Please sign in to comment.