mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
Fix oassenger information back button redirect url issue
This commit is contained in:
@@ -679,7 +679,7 @@ type FormData = z.infer<ReturnType<typeof createFormSchema>>;
|
||||
|
||||
function PassengersForm() {
|
||||
const router = useRouter();
|
||||
const { searchCriteria, passengers: storedPassengers, setPassengers, setCreateAccount } = useBookingStore();
|
||||
const { searchCriteria, passengers: storedPassengers, setPassengers, setCreateAccount, packageId } = useBookingStore();
|
||||
const { user, isAuthenticated, updateUser } = useAuthStore();
|
||||
const isInitialized = useAuthStore((s) => s.isInitialized);
|
||||
const [faydaEnabled, setFaydaEnabled] = useState(true);
|
||||
@@ -1474,6 +1474,15 @@ function PassengersForm() {
|
||||
|
||||
<div className="flex gap-4">
|
||||
<button type="button" onClick={() => {
|
||||
// Package bookings skip results/seats entirely — they land here directly
|
||||
// from /packages/[id] via a plain router.push. Hardcoding a return to
|
||||
// /booking/results would be wrong for that flow (it was never visited), so
|
||||
// use real browser back navigation instead, which lands exactly back on the
|
||||
// package page with its original URL/state intact.
|
||||
if (packageId) {
|
||||
router.back();
|
||||
return;
|
||||
}
|
||||
const params = new URLSearchParams({
|
||||
origin: searchCriteria.originStationId,
|
||||
destination: searchCriteria.destinationStationId,
|
||||
|
||||
Reference in New Issue
Block a user