Sending cookies with fetch, bg color change

This commit is contained in:
MrFry 2020-04-08 18:12:20 +02:00
parent 9f576a41f6
commit cbba4cd616
10 changed files with 21 additions and 11 deletions

View file

@ -1,5 +1,5 @@
{ {
"apiUrl": "http://api.frylabs.net/", "apiUrl": "https://api.frylabs.net/",
"mobileWindowWidth": 700, "mobileWindowWidth": 700,
"maxQuestionsToRender": 250 "maxQuestionsToRender": 250
} }

View file

@ -1,7 +1,7 @@
:root { :root {
--text-color: #9999ff; --text-color: #9999ff;
--bright-color: #f2f2f2; --bright-color: #f2f2f2;
--background-color: #212127; --background-color: #222426;
--hoover-color: #202020; --hoover-color: #202020;
} }
@ -28,7 +28,7 @@ a {
margin: 0; margin: 0;
padding: 0; padding: 0;
width: 200px; width: 200px;
background-color: #212127; background-color: #222426;
position: fixed; position: fixed;
height: 100%; height: 100%;
overflow: auto; overflow: auto;

View file

@ -10,7 +10,7 @@ class MyDocument extends Document {
return ( return (
<Html> <Html>
<Head /> <Head />
<body bgcolor='#212127'> <body bgcolor='#222426'>
<Main /> <Main />
<NextScript /> <NextScript />
</body> </body>

View file

@ -12,7 +12,9 @@ export default function AllQuestions (props) {
const [searchTerm, setSearchTerm] = useState('') const [searchTerm, setSearchTerm] = useState('')
useEffect(() => { useEffect(() => {
fetch(`${constants.apiUrl}data.json`) fetch(`${constants.apiUrl}data.json`, {
credentials: 'include'
})
.then((resp) => { .then((resp) => {
return resp.json() return resp.json()
}) })

View file

@ -1,7 +1,7 @@
.searchBar { .searchBar {
margin: 10px; margin: 10px;
color: white; color: white;
background-color: #212127; background-color: #222426;
border: none; border: none;
font-size: 18px; font-size: 18px;
flex-grow: 1; flex-grow: 1;

View file

@ -73,6 +73,7 @@ export default function Feedback (props) {
const rawResponse = await fetch(constants.apiUrl + 'postfeedback', { const rawResponse = await fetch(constants.apiUrl + 'postfeedback', {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@ -102,6 +103,7 @@ export default function Feedback (props) {
const rawFileResponse = await fetch(constants.apiUrl + 'postfeedbackfile', { const rawFileResponse = await fetch(constants.apiUrl + 'postfeedbackfile', {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Accept': 'application/json' 'Accept': 'application/json'
}, },

View file

@ -16,7 +16,9 @@ export default function Index (props) {
useEffect(() => { useEffect(() => {
console.info('Fetching news.json') console.info('Fetching news.json')
fetch(`${constants.apiUrl}news.json`) // eslint-disable-line fetch(`${constants.apiUrl}news.json`, {
credentials: 'include'
})
.then((resp) => { .then((resp) => {
return resp.json() return resp.json()
}) })
@ -27,7 +29,9 @@ export default function Index (props) {
useEffect(() => { useEffect(() => {
console.info('Fetching data') console.info('Fetching data')
fetch(`${constants.apiUrl}motd`) fetch(`${constants.apiUrl}motd`, {
credentials: 'include'
})
.then((resp) => { .then((resp) => {
return resp.text() return resp.text()
}) })

View file

@ -18,7 +18,9 @@ export default function SubjectBrowser (props) {
useEffect(() => { useEffect(() => {
console.info('Fetching data') console.info('Fetching data')
fetch(`${constants.apiUrl}data.json`) fetch(`${constants.apiUrl}data.json`, {
credentials: 'include'
})
.then((resp) => { .then((resp) => {
return resp.json() return resp.json()
}) })

View file

@ -1,7 +1,7 @@
.searchBar { .searchBar {
margin: 10px; margin: 10px;
color: white; color: white;
background-color: #212127; background-color: #222426;
border: none; border: none;
font-size: 18px; font-size: 18px;
flex-grow: 1; flex-grow: 1;

View file

@ -8,7 +8,7 @@
<style> <style>
:root{ :root{
--size: 100px; --size: 100px;
--bgcolor: #212127; --bgcolor: #222426;
--color: #fcff4f; --color: #fcff4f;
--shadow: rgba(30,2,5,.2); --shadow: rgba(30,2,5,.2);
} }