mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 17:45:42 +00:00
Enable skip fayda for dev
This commit is contained in:
@@ -685,6 +685,19 @@ function PassengersForm() {
|
|||||||
const { user, isAuthenticated, updateUser } = useAuthStore();
|
const { user, isAuthenticated, updateUser } = useAuthStore();
|
||||||
const isInitialized = useAuthStore((s) => s.isInitialized);
|
const isInitialized = useAuthStore((s) => s.isInitialized);
|
||||||
const [faydaEnabled, setFaydaEnabled] = useState(true);
|
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 [verificationStatus, setVerificationStatus] = useState<Record<number, 'pending' | 'success' | 'error'>>({});
|
||||||
const [faydaErrors, setFaydaErrors] = useState<Record<number, string>>({});
|
const [faydaErrors, setFaydaErrors] = useState<Record<number, string>>({});
|
||||||
// The passenger currently mid-verification (popup open / awaiting callback). Only one
|
// The passenger currently mid-verification (popup open / awaiting callback). Only one
|
||||||
@@ -1166,14 +1179,16 @@ function PassengersForm() {
|
|||||||
Finish verifying Passenger {(verifyingIndex ?? 0) + 1} first
|
Finish verifying Passenger {(verifyingIndex ?? 0) + 1} first
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{/* <button
|
{allowSkipFaydaVerification && (
|
||||||
type="button"
|
<button
|
||||||
onClick={() => toggleForm(index)}
|
type="button"
|
||||||
disabled={isVerifyingThis}
|
onClick={() => toggleForm(index)}
|
||||||
className="text-sm text-gray-500 dark:text-gray-400 hover:underline mt-3 block mx-auto disabled:opacity-50 disabled:cursor-not-allowed"
|
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> */}
|
Skip for now
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : showManualEntryLink ? (
|
) : showManualEntryLink ? (
|
||||||
<div className="text-center py-8">
|
<div className="text-center py-8">
|
||||||
|
|||||||
Reference in New Issue
Block a user