Fix error message on passenger information

This commit is contained in:
Roba Boru
2026-07-14 10:14:42 +03:00
parent 0e18df6ad9
commit 1f34c06130

View File

@@ -994,8 +994,20 @@ function PassengersForm() {
const onInvalid = () => {
// Sections still behind the Fayda verify screen stay collapsed here — they only expand
// when the user explicitly clicks "Enter details manually" (shown only when Fayda is
// unavailable).
setSubmitError('Please fix the highlighted errors before continuing.');
// unavailable). Their name/DOB/gender fields are still empty at this point, which would
// otherwise surface as a generic "fix the highlighted errors" message that doesn't point
// at the actual cause — tell the user to verify with Fayda instead.
const needsFaydaVerification = passengers.some((p, i) => {
const isEthiopian = p?.nationality === 'ETHIOPIAN';
const isChildPassenger = i >= adultCount;
const isLoggedInAndVerified = i === 0 && isAuthenticated && user?.faydaVerified;
return isEthiopian && faydaEnabled && !p?.formExpanded && !isLoggedInAndVerified && !isChildPassenger;
});
setSubmitError(
needsFaydaVerification
? 'Please verify your identity with Fayda before continuing — tap "Verify with Fayda" above to proceed.'
: 'Please fix the highlighted errors before continuing.'
);
};
const onSubmit = async (data: FormData) => {