mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 02:30:55 +00:00
Merge pull request #660 from Tria-plc/alpha
Fix error message on passenger information
This commit is contained in:
@@ -994,8 +994,20 @@ function PassengersForm() {
|
|||||||
const onInvalid = () => {
|
const onInvalid = () => {
|
||||||
// Sections still behind the Fayda verify screen stay collapsed here — they only expand
|
// 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
|
// when the user explicitly clicks "Enter details manually" (shown only when Fayda is
|
||||||
// unavailable).
|
// unavailable). Their name/DOB/gender fields are still empty at this point, which would
|
||||||
setSubmitError('Please fix the highlighted errors before continuing.');
|
// 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) => {
|
const onSubmit = async (data: FormData) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user