Skip to content

Commit

Permalink
Account for boolean filters
Browse files Browse the repository at this point in the history
  • Loading branch information
futa-ikeda committed Nov 27, 2024
1 parent 1c638d0 commit 637f9c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/institutions/dashboard/-components/object-list/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ export default class InstitutionalObjectList extends Component<InstitutionalObje
if (key === 'cardSearchFilter') {
Object.entries(value).forEach(([filterKey, filterValue]) => {
const cardSearchFilterKey = `cardSearchFilter[${filterKey}]`;
// check if filterValue is an object, for boolean filters
if (typeof filterValue === 'object' && !Array.isArray(filterValue)) {
Object.entries(filterValue).forEach(([nestedFilterKey, nestedFilterValue]) => {
searchUrl.searchParams.append(
`${cardSearchFilterKey}[${nestedFilterKey}]`,
(nestedFilterValue as boolean).toString(),
);
});
return;
}
searchUrl.searchParams.set(cardSearchFilterKey, filterValue.toString());
});
} else {
Expand Down

0 comments on commit 637f9c6

Please sign in to comment.