change the route according to cityName instead of id

This commit is contained in:
aryabenade
2026-04-09 15:29:17 +05:30
parent 7c9ec2c285
commit 169a29f63c
2 changed files with 8 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ export function CitySelectionDialog({
// ✅ Call the onCitySelect callback if provided (passing cityId)
if (onCitySelect) {
onCitySelect(String(city.id));
onCitySelect(String(city.cityName));
} else {
// ✅ Default behavior: navigate to passes page
navigate(`/passes?city=${encodeURIComponent(city.cityName)}`);

View File

@@ -299,11 +299,11 @@ export default function Navbar({
setDialogSource('navbar');
};
const handleCitySelectFromNavbar = (cityId: string) => {
console.log('City selected from navbar:', cityId);
onCityChange(cityId);
const handleCitySelectFromNavbar = (cityName: string) => {
console.log('City selected from navbar:', cityName);
onCityChange(cityName);
if (cityId.toLowerCase() === '1') {
if (cityName.toLowerCase() === 'melbourne') {
setNavigationSource('melbourne');
navigate('/melbourne');
} else {
@@ -334,11 +334,11 @@ export default function Navbar({
handleCloseCityDialog();
};
const handleCitySelect = (cityId: string) => {
const handleCitySelect = (cityName: string) => {
if (dialogSource === 'cta') {
handleCitySelectFromCTA(cityId);
handleCitySelectFromCTA(cityName);
} else {
handleCitySelectFromNavbar(cityId);
handleCitySelectFromNavbar(cityName);
}
};