feat(BOOK-54): Adjusted filter functionality to save filters as query parameters instead of paths
* feat(BOOK-54): Destination filters now matching on id instead of slug in preparation for filters from Contentstack Approved-by: Chuma Mcphoy (We Ahead)
This commit is contained in:
@@ -24,10 +24,14 @@ export default function DestinationDataProviderContent({
|
||||
const filterParam = searchParams.get("filter")
|
||||
const filters = []
|
||||
const pathParts = currentPathname.split("/")
|
||||
const lastPathPart = pathParts[pathParts.length - 1]
|
||||
const filterFromUrl = pathParts[pathParts.length - 1]
|
||||
|
||||
// Even though the user filter is stored in the query param,
|
||||
// we also support having it as the last part of the pathname
|
||||
// e.g. /destination/copenhagen/spa
|
||||
// In this case we need to add it to the filters array
|
||||
if (basePath !== currentPathname) {
|
||||
filters.push(lastPathPart)
|
||||
filters.push(filterFromUrl)
|
||||
}
|
||||
if (filterParam) {
|
||||
filters.push(...filterParam.split("&"))
|
||||
|
||||
@@ -15,7 +15,6 @@ export default function DestinationDataProvider({
|
||||
allCities = [],
|
||||
allHotels,
|
||||
allFilters,
|
||||
filterFromUrl,
|
||||
sortItems,
|
||||
pathname,
|
||||
children,
|
||||
@@ -28,7 +27,6 @@ export default function DestinationDataProvider({
|
||||
allCities,
|
||||
allHotels,
|
||||
allFilters,
|
||||
filterFromUrl,
|
||||
pathname,
|
||||
sortItems,
|
||||
searchParams,
|
||||
|
||||
Reference in New Issue
Block a user