mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
Enable skip fayda for dev
This commit is contained in:
@@ -685,6 +685,19 @@ function PassengersForm() {
|
||||
const { user, isAuthenticated, updateUser } = useAuthStore();
|
||||
const isInitialized = useAuthStore((s) => s.isInitialized);
|
||||
const [faydaEnabled, setFaydaEnabled] = useState(true);
|
||||
// "Skip for now" (bypasses Fayda verification) is only offered on local dev and the
|
||||
// staging/test domain — never on an unrecognized host, which would include production.
|
||||
// Starts false (matches SSR, where window isn't available) and is only ever flipped to
|
||||
// true client-side after mount, so there's no server/client hydration mismatch.
|
||||
const [allowSkipFaydaVerification, setAllowSkipFaydaVerification] = useState(false);
|
||||
useEffect(() => {
|
||||
const hostname = window.location.hostname;
|
||||
setAllowSkipFaydaVerification(
|
||||
hostname === "localhost" ||
|
||||
hostname === "127.0.0.1" ||
|
||||
hostname === "edrpassenger.triaplc.com",
|
||||
);
|
||||
}, []);
|
||||
const [verificationStatus, setVerificationStatus] = useState<Record<number, 'pending' | 'success' | 'error'>>({});
|
||||
const [faydaErrors, setFaydaErrors] = useState<Record<number, string>>({});
|
||||
// The passenger currently mid-verification (popup open / awaiting callback). Only one
|
||||
@@ -1166,14 +1179,16 @@ function PassengersForm() {
|
||||
Finish verifying Passenger {(verifyingIndex ?? 0) + 1} first
|
||||
</p>
|
||||
)}
|
||||
{/* <button
|
||||
type="button"
|
||||
onClick={() => toggleForm(index)}
|
||||
disabled={isVerifyingThis}
|
||||
className="text-sm text-gray-500 dark:text-gray-400 hover:underline mt-3 block mx-auto disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
Skip for now
|
||||
</button> */}
|
||||
{allowSkipFaydaVerification && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => toggleForm(index)}
|
||||
disabled={isVerifyingThis}
|
||||
className="text-sm text-gray-500 dark:text-gray-400 hover:underline mt-3 block mx-auto disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
Skip for now
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
) : showManualEntryLink ? (
|
||||
<div className="text-center py-8">
|
||||
|
||||
Reference in New Issue
Block a user