Skip to content

Commit

Permalink
fix: product list after a logged in user clicked a filter navigation …
Browse files Browse the repository at this point in the history
…link on family page (#1300)
  • Loading branch information
SGrueber authored Oct 14, 2022
1 parent ea1d8d5 commit ef8e2ba
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/app/core/models/filter-navigation/filter-navigation.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ export class FilterNavigationMapper {
private mapFacetData(filterData: FilterData) {
return filterData.filterEntries
? filterData.filterEntries.reduce((acc, facet) => {
const category = facet.link.uri.includes('/categories/')
? [facet.link.uri.split('/productfilters')[0].split('/categories/')[1]]
const uri = this.removeSpgidFromUri(facet.link.uri);
const category = uri.includes('/categories/')
? [uri.split('/productfilters')[0].split('/categories/')[1]]
: undefined;
if (facet.name !== 'Show all') {
acc.push({
Expand All @@ -70,4 +71,15 @@ export class FilterNavigationMapper {
}, [])
: [];
}

private removeSpgidFromUri(uri: string): string {
if (!uri?.includes(';spgid')) {
return uri;
}

const pgidStart = uri.indexOf(';spgid');
const pgidEnd = uri.indexOf('/', pgidStart);

return uri.replace(uri.substring(pgidStart, pgidEnd), '');
}
}

0 comments on commit ef8e2ba

Please sign in to comment.