Cleaned up usage of fetch

This commit is contained in:
2022-06-10 16:53:42 +01:00
parent ed01fe6db5
commit 490860159e
6 changed files with 11 additions and 22 deletions
+1 -3
View File
@@ -23,9 +23,7 @@ const Account = props => {
//grab the user's info
useEffect(() => {
authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/account`, {
method: 'GET'
})
authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/account`)
.then(blob => blob.json())
.then(json => contactRef.current.checked = json.contact)
.catch(e => console.error(e))
@@ -18,12 +18,7 @@ const NewsEditor = props => {
//run once
useEffect(async () => {
const result = await fetch(`${process.env.NEWS_URI}/news/metadata?limit=999`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
});
const result = await fetch(`${process.env.NEWS_URI}/news/metadata?limit=999`);
if (!result.ok) {
const err = `${result.status}: ${await result.text()}`;
-4
View File
@@ -8,10 +8,6 @@ const NewsFeed = props => {
useEffect(() => {
//this... um...
fetch(`${process.env.NEWS_URI}/news`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
signal: aborter.current.signal //oh dear
})
.then(blob => blob.json())
+3 -4
View File
@@ -2,15 +2,14 @@ import React from 'react';
const Static = props => {
return (
<>
<div className='page central'>
<header>
<h1 className='text centered'>Credits</h1>
</header>
<h2>MERN-template</h2>
<h2 className='text centered'>MERN-template</h2>
<p>The <a href='https://github.com/krgamestudios/MERN-template'>MERN-template</a> developed by Kayne Ruse, KR Game Studios</p>
</>
</div>
);
};
export default Static;
+5 -4
View File
@@ -2,11 +2,12 @@ import React from 'react';
const Static = props => {
return (
<header>
<h1 className="text centered">Privacy Policy</h1>
</header>
<div className='page central'>
<header>
<h1 className="text centered">Privacy Policy</h1>
</header>
</div>
);
};
export default Static;