js: fix pays API request on older Edge and Safari
The /api/pays API requires user authentication. However older versions of Edge and Safari don't transmit cookies by default during a `fetch` request. Use the `credentials: 'same-origin'` option explicitely to fix the countries list.
This commit is contained in:
parent
7f588baa83
commit
b2774ed2f6
1 changed files with 2 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
import { QueryClient } from 'react-query';
|
||||
import { isNumeric } from '@utils';
|
||||
import { getJSON, isNumeric } from '@utils';
|
||||
import { matchSorter } from 'match-sorter';
|
||||
|
||||
const API_EDUCATION_QUERY_LIMIT = 5;
|
||||
|
@ -73,7 +73,7 @@ async function defaultQueryFn({ queryKey: [scope, term] }) {
|
|||
let paysCache;
|
||||
async function getPays() {
|
||||
if (!paysCache) {
|
||||
paysCache = await fetch('/api/pays').then((response) => response.json());
|
||||
paysCache = await getJSON('/api/pays', null);
|
||||
}
|
||||
return paysCache;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue