Skip to content

Commit

Permalink
export: fix the url generation
Browse files Browse the repository at this point in the history
* Closes rero/rero-ils#3265.

Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed May 8, 2024
1 parent 71e6a2e commit 1ad1ff0
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ export class RecordSearchComponent implements OnInit, OnChanges, OnDestroy {
* @return formatted url for an export format.
*/
getExportFormatUrl(format: any) {
const queryParams = Object.keys(this.activatedRoute.snapshot.queryParams);
// TODO: maybe we can use URLSerializer to build query string
const baseUrl = format.endpoint
? format.endpoint
Expand All @@ -613,7 +614,11 @@ export class RecordSearchComponent implements OnInit, OnChanges, OnDestroy {
// force value to an array
const values = (!Array.isArray(value)) ? [value] : value;
values.map(v => {
url += `&${key}=${v}`;
// We check whether the parameter exists in the current url.
// If it does, we don't add the preFilter parameter.
if (!queryParams.includes(key)) {
url += `&${key}=${v}`;
}
});
}
}
Expand Down

0 comments on commit 1ad1ff0

Please sign in to comment.