Skip to content

Commit

Permalink
use achData state for checking valid account
Browse files Browse the repository at this point in the history
  • Loading branch information
c3024 committed Sep 20, 2024
1 parent ba18d87 commit 5307045
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/MoneyReportHeaderStatusBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@ const iconMap: IconMap = {

function MoneyReportHeaderStatusBar({nextStep, policy, report}: MoneyReportHeaderStatusBarProps) {
console.log('policy', policy, 'report', report);
const prevAccountStatus = !!usePrevious(policy?.achAccount?.accountNumber);
const accountStatus = !!policy?.achAccount?.accountNumber;
const prevAccountStatus = usePrevious(policy?.achAccount?.state);
const accountStatus = policy?.achAccount?.state;
useEffect(() => {
if (prevAccountStatus === accountStatus) {
return;
}
if (accountStatus !== 'OPEN') {
return;
}
console.log("reached beyond the early return of useEffect")
if (report?.statusNum === 1 && isSubmitAndClose(policy)) {
NextStepUtils.buildNextStep(report, 4);
NextStepUtils.buildNextStep(report, 3);
}
if (report?.statusNum === 3) {
NextStepUtils.buildNextStep(report, 4);
NextStepUtils.buildNextStep(report, 3);
}
}, [prevAccountStatus, accountStatus, policy, report]);
const styles = useThemeStyles();
Expand Down

0 comments on commit 5307045

Please sign in to comment.