Merge pull request #8698 from tchak/fix-adresse-select
fix(autocomplete): avoid double escape of query params
This commit is contained in:
commit
b9080e2ff5
1 changed files with 6 additions and 1 deletions
|
@ -26,7 +26,7 @@ type QueryKey = readonly [
|
|||
];
|
||||
|
||||
function buildURL(scope: string, term: string, extra?: string) {
|
||||
term = encodeURIComponent(term.replace(/\(|\)/g, ''));
|
||||
term = term.replace(/\(|\)/g, '');
|
||||
const params = new URLSearchParams();
|
||||
let path = `${api_geo_url}/${scope}`;
|
||||
|
||||
|
@ -73,6 +73,11 @@ const defaultQueryFn: QueryFunction<unknown, QueryKey> = async ({
|
|||
return matchSorter(await getPays(signal), term, { keys: ['label'] });
|
||||
}
|
||||
|
||||
// BAN will error with queries less then 3 chars long
|
||||
if (scope == 'adresse' && term.length < 3) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const url = buildURL(scope, term, extra);
|
||||
return httpRequest(url, { csrf: false, signal }).json();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue