From cbba4cd61605363d69d74b96d8b10286ece959b6 Mon Sep 17 00:00:00 2001 From: MrFry Date: Wed, 8 Apr 2020 18:12:20 +0200 Subject: [PATCH] Sending cookies with fetch, bg color change --- src/constants.json | 2 +- src/defaultStyles.css | 4 ++-- src/pages/_document.js | 2 +- src/pages/allQuestions.js | 4 +++- src/pages/allQuestions.module.css | 2 +- src/pages/feedback.js | 2 ++ src/pages/index.js | 8 ++++++-- src/pages/subjectBrowser.js | 4 +++- src/pages/subjectBrowser.module.css | 2 +- src/pages/thanks.html | 2 +- 10 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/constants.json b/src/constants.json index 632caa0..afc85f3 100644 --- a/src/constants.json +++ b/src/constants.json @@ -1,5 +1,5 @@ { - "apiUrl": "http://api.frylabs.net/", + "apiUrl": "https://api.frylabs.net/", "mobileWindowWidth": 700, "maxQuestionsToRender": 250 } diff --git a/src/defaultStyles.css b/src/defaultStyles.css index a2531da..1aa1a5b 100644 --- a/src/defaultStyles.css +++ b/src/defaultStyles.css @@ -1,7 +1,7 @@ :root { --text-color: #9999ff; --bright-color: #f2f2f2; - --background-color: #212127; + --background-color: #222426; --hoover-color: #202020; } @@ -28,7 +28,7 @@ a { margin: 0; padding: 0; width: 200px; - background-color: #212127; + background-color: #222426; position: fixed; height: 100%; overflow: auto; diff --git a/src/pages/_document.js b/src/pages/_document.js index 3076cf6..5e43ea1 100644 --- a/src/pages/_document.js +++ b/src/pages/_document.js @@ -10,7 +10,7 @@ class MyDocument extends Document { return ( - +
diff --git a/src/pages/allQuestions.js b/src/pages/allQuestions.js index 6ecfd18..d2995c8 100644 --- a/src/pages/allQuestions.js +++ b/src/pages/allQuestions.js @@ -12,7 +12,9 @@ export default function AllQuestions (props) { const [searchTerm, setSearchTerm] = useState('') useEffect(() => { - fetch(`${constants.apiUrl}data.json`) + fetch(`${constants.apiUrl}data.json`, { + credentials: 'include' + }) .then((resp) => { return resp.json() }) diff --git a/src/pages/allQuestions.module.css b/src/pages/allQuestions.module.css index eaea0fc..15580ff 100644 --- a/src/pages/allQuestions.module.css +++ b/src/pages/allQuestions.module.css @@ -1,7 +1,7 @@ .searchBar { margin: 10px; color: white; - background-color: #212127; + background-color: #222426; border: none; font-size: 18px; flex-grow: 1; diff --git a/src/pages/feedback.js b/src/pages/feedback.js index 56c93fc..0653e68 100644 --- a/src/pages/feedback.js +++ b/src/pages/feedback.js @@ -73,6 +73,7 @@ export default function Feedback (props) { const rawResponse = await fetch(constants.apiUrl + 'postfeedback', { method: 'POST', + credentials: 'include', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' @@ -102,6 +103,7 @@ export default function Feedback (props) { const rawFileResponse = await fetch(constants.apiUrl + 'postfeedbackfile', { method: 'POST', + credentials: 'include', headers: { 'Accept': 'application/json' }, diff --git a/src/pages/index.js b/src/pages/index.js index 18ab108..4d6829c 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -16,7 +16,9 @@ export default function Index (props) { useEffect(() => { console.info('Fetching news.json') - fetch(`${constants.apiUrl}news.json`) // eslint-disable-line + fetch(`${constants.apiUrl}news.json`, { + credentials: 'include' + }) .then((resp) => { return resp.json() }) @@ -27,7 +29,9 @@ export default function Index (props) { useEffect(() => { console.info('Fetching data') - fetch(`${constants.apiUrl}motd`) + fetch(`${constants.apiUrl}motd`, { + credentials: 'include' + }) .then((resp) => { return resp.text() }) diff --git a/src/pages/subjectBrowser.js b/src/pages/subjectBrowser.js index 63927bb..64edc3e 100644 --- a/src/pages/subjectBrowser.js +++ b/src/pages/subjectBrowser.js @@ -18,7 +18,9 @@ export default function SubjectBrowser (props) { useEffect(() => { console.info('Fetching data') - fetch(`${constants.apiUrl}data.json`) + fetch(`${constants.apiUrl}data.json`, { + credentials: 'include' + }) .then((resp) => { return resp.json() }) diff --git a/src/pages/subjectBrowser.module.css b/src/pages/subjectBrowser.module.css index 56c1e12..a166353 100644 --- a/src/pages/subjectBrowser.module.css +++ b/src/pages/subjectBrowser.module.css @@ -1,7 +1,7 @@ .searchBar { margin: 10px; color: white; - background-color: #212127; + background-color: #222426; border: none; font-size: 18px; flex-grow: 1; diff --git a/src/pages/thanks.html b/src/pages/thanks.html index a83885f..16cb060 100644 --- a/src/pages/thanks.html +++ b/src/pages/thanks.html @@ -8,7 +8,7 @@