diff --git a/src/api/details.ts b/src/api/details.ts index 8a9e5ad..f5787c9 100644 --- a/src/api/details.ts +++ b/src/api/details.ts @@ -3,6 +3,9 @@ import { getDetailsUrl } from './settings'; async function fetchDetails(url: string) { const res = await fetch(`${process.env.apiHost}${url}`, { next: { revalidate: 60 * 60 }, + headers: { + Accept: 'application/json', + }, }); if (res.status < 200 || res.status > 299) { throw new Error('Failed to fetch data'); diff --git a/src/api/observations.ts b/src/api/observations.ts index e140159..e1dd678 100644 --- a/src/api/observations.ts +++ b/src/api/observations.ts @@ -16,6 +16,9 @@ async function fetchObservation() { `${process.env.apiHost}/api/portal/fr/${process.env.portal}/contributions/json_schema/`, { next: { revalidate: 60 * 60 }, + headers: { + Accept: 'application/json', + }, }, ); if (res.status < 200 || res.status > 299) { diff --git a/src/api/page.ts b/src/api/page.ts index 1303c8d..b726609 100644 --- a/src/api/page.ts +++ b/src/api/page.ts @@ -3,6 +3,9 @@ import { Menu, getMenuSettings } from './settings'; async function fetchDetails(url: string) { const res = await fetch(`${process.env.apiHost}${url}`, { next: { revalidate: 60 * 60 }, + headers: { + Accept: 'application/json', + }, }); if (res.status < 200 || res.status > 299) { throw new Error('Failed to fetch data'); diff --git a/src/api/poi.ts b/src/api/poi.ts index 32fbf71..e0b13e9 100644 --- a/src/api/poi.ts +++ b/src/api/poi.ts @@ -20,6 +20,9 @@ async function fetchPois({ params }: FetchPoisProps = {}): Promise { const url = `${process.env.apiHost}/api/portal/fr/${process.env.portal}/pois/`; const urlWithParams = [url, params].filter(Boolean).join('?'); const res = await fetch(urlWithParams, { + headers: { + Accept: 'application/json', + }, next: { revalidate: 60 * 60 }, }); if (res.status < 200 || res.status > 299) { diff --git a/src/api/settings.ts b/src/api/settings.ts index d5fb879..e8eccbb 100644 --- a/src/api/settings.ts +++ b/src/api/settings.ts @@ -155,6 +155,9 @@ export async function fetchSettings(): Promise { `${process.env.apiHost}/api/portal/fr/portal/${process.env.portal}/`, { next: { revalidate: 60 * 60 }, + headers: { + Accept: 'application/json', + }, }, ).catch(error => { throw error;