From 9ee72f7d9e80cf76ed9059bb3f6ff5fff1a1391a Mon Sep 17 00:00:00 2001 From: hippoz Date: Fri, 22 Jan 2021 23:57:13 +0200 Subject: [PATCH] make change that could possibly make the app work on a different subdomain than the api --- bfrontend/src/APIRequest.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bfrontend/src/APIRequest.js b/bfrontend/src/APIRequest.js index 4916ada..3b25afa 100644 --- a/bfrontend/src/APIRequest.js +++ b/bfrontend/src/APIRequest.js @@ -6,6 +6,14 @@ async function APIRequest(endpoint, options) { let isOK = false; let err; + if (!options) options = {}; + if (!options.headers) options.headers = {}; + + options = { + credentials: 'include', + ...options + }; + try { res = await fetch(`${config.apiUrl}${endpoint}`, options); json = await res.json();