Merge pull request #612 from Tria-plc/alpha

Fix passenger information back button redirect url issue
This commit is contained in:
Abubeker Yasin
2026-07-11 09:49:47 +03:00
committed by GitHub

View File

@@ -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,