mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 09:58:12 +00:00
Merge pull request #612 from Tria-plc/alpha
Fix passenger information back button redirect url issue
This commit is contained in:
@@ -679,7 +679,7 @@ type FormData = z.infer<ReturnType<typeof createFormSchema>>;
|
|||||||
|
|
||||||
function PassengersForm() {
|
function PassengersForm() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { searchCriteria, passengers: storedPassengers, setPassengers, setCreateAccount } = useBookingStore();
|
const { searchCriteria, passengers: storedPassengers, setPassengers, setCreateAccount, packageId } = useBookingStore();
|
||||||
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);
|
||||||
@@ -1474,6 +1474,15 @@ function PassengersForm() {
|
|||||||
|
|
||||||
<div className="flex gap-4">
|
<div className="flex gap-4">
|
||||||
<button type="button" onClick={() => {
|
<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({
|
const params = new URLSearchParams({
|
||||||
origin: searchCriteria.originStationId,
|
origin: searchCriteria.originStationId,
|
||||||
destination: searchCriteria.destinationStationId,
|
destination: searchCriteria.destinationStationId,
|
||||||
|
|||||||
Reference in New Issue
Block a user