integrate the super savings offer api

This commit is contained in:
aryabenade
2026-04-16 17:24:56 +05:30
parent 8ad18cf7eb
commit a7098e81d6
4 changed files with 472 additions and 600 deletions

View File

@@ -88,7 +88,7 @@ export function AppRouter({
} />
{/* Home Route */}
<Route path="/:cityName/:cityId" element={
<Route path="/:cityName" element={
<motion.div key="home" {...pageTransition}>
<MelbournePage {...commonNavHandlers} />
</motion.div>
@@ -106,7 +106,7 @@ export function AppRouter({
} />
{/* Attractions Routes */}
<Route path="/:cityName/:cityId/attractions" element={
<Route path="/:cityName/attractions" element={
<motion.div key="attractions" {...pageTransition}>
<AttractionsPage {...commonNavHandlers} />
</motion.div>
@@ -265,7 +265,7 @@ export function AppRouter({
</motion.div>
} />
<Route path="/super-savings" element={
<Route path="/:cityName/super-savings" element={
<motion.div key="super-savings" {...pageTransition}>
<SuperSavingsPage {...commonNavHandlers} />
</motion.div>

View File

@@ -20,15 +20,28 @@ export const citiesApi = createApi({
}),
getUpcomingCities: builder.query({
query: (listType) => `/cities/list/all?listType=${listType}`,
}),
getSelectedCityDetails:builder.query({
query: (cityId) => `/website/${cityId}`,
})
getSelectedCityDetails: builder.query({
query: (cityId) => `/website/${cityId}`,
}),
getSelectedCityOffers: builder.query({
query: ({ cityId, categoryId, page, limit }) => {
const params = new URLSearchParams()
params.append('cityXid', cityId);
if (categoryId) params.append('categoryXid', categoryId);
if (page) params.append('page', page);
if (limit) params.append('limit', limit);
return `/website/super-savings/list/offers?${params.toString()}`;
}
}),
}),
});
export const { useGetCityListWithBannerQuery,useGetUpcomingCitiesQuery,useGetSelectedCityDetailsQuery } = citiesApi;
export const { useGetCityListWithBannerQuery, useGetUpcomingCitiesQuery, useGetSelectedCityDetailsQuery, useGetSelectedCityOffersQuery } = citiesApi;

View File

@@ -42,20 +42,9 @@ export function CitySelectionDialog({
const handleCityClick = (city: City) => {
console.log('Selected city:', city.cityName);
// ✅ Call the onCitySelect callback if provided (passing cityId)
if (onCitySelect) {
// onCitySelect(String(city.cityName));
// navigate(`/${city.cityName}/${city.id}`)
navigate(`/${slugify(city.cityName)}`);
localStorage.setItem("cityId", String(city.id))
localStorage.setItem("cityName", String(city.cityName))
} else {
// ✅ Default behavior: navigate to passes page
navigate(`/passes?city=${encodeURIComponent(city.cityName)}`);
}
navigate(`/${slugify(city.cityName)}`);
localStorage.setItem("cityId", String(city.id))
localStorage.setItem("cityName", String(city.cityName))
onClose();
};

File diff suppressed because it is too large Load Diff