Merge pull request #6506 from betagouv/fix-pays-on-edge

Correction du champ "Pays" sous Edge et Safari (#6506)
This commit is contained in:
Pierre de La Morinerie 2021-09-30 16:46:14 +02:00 committed by GitHub
commit 07481d1093
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
import { QueryClient } from 'react-query'; import { QueryClient } from 'react-query';
import { isNumeric } from '@utils'; import { getJSON, isNumeric } from '@utils';
import { matchSorter } from 'match-sorter'; import { matchSorter } from 'match-sorter';
const API_EDUCATION_QUERY_LIMIT = 5; const API_EDUCATION_QUERY_LIMIT = 5;
@ -73,7 +73,7 @@ async function defaultQueryFn({ queryKey: [scope, term] }) {
let paysCache; let paysCache;
async function getPays() { async function getPays() {
if (!paysCache) { if (!paysCache) {
paysCache = await fetch('/api/pays').then((response) => response.json()); paysCache = await getJSON('/api/pays', null);
} }
return paysCache; return paysCache;
} }