diff --git a/src/theme/DocRoot/Layout/FetchUser/index.js b/src/theme/DocRoot/Layout/FetchUser/index.js index f85baf35e..8e47af996 100644 --- a/src/theme/DocRoot/Layout/FetchUser/index.js +++ b/src/theme/DocRoot/Layout/FetchUser/index.js @@ -2,14 +2,14 @@ export default async function fetchUser() { const url = 'https://data.pro.hasura.io/v1/graphql'; const headers = { - Accept: '*/*', + 'Accept': '*/*', 'Accept-Language': 'en-US,en;q=0.9,es-US;q=0.8,es;q=0.7', 'Content-Type': 'application/json', 'Hasura-Client-Name': 'hasura-docs', - Origin: 'https://hasura.io/docs/3.0', - Referer: 'https://hasura.io/docs/3.0', - 'Sec-Fetch-Mode': 'cors', - 'Sec-Fetch-Site': 'same-site', + 'Origin': 'https://hasura.io', + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'POST, OPTIONS', + 'Access-Control-Allow-Headers': 'Content-Type', }; const body = { @@ -27,9 +27,15 @@ export default async function fetchUser() { const response = await fetch(url, { method: 'POST', headers: headers, + credentials: 'include', + mode: 'cors', body: JSON.stringify(body), }); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + const data = await response.json(); console.log(data); return data;