Cleaned up usage of fetch
This commit is contained in:
@@ -39,7 +39,7 @@ docker-compose up --build
|
||||
To set up this template in development mode:
|
||||
|
||||
1. Ensure mariadb is running in your development environment
|
||||
2. Run `mariadb sql/create_database.sql` as the root user
|
||||
2. Run `mariadb tools/create_database.sql` as the root user
|
||||
3. Run `npm install`
|
||||
4. Run `cp .envdev .env` and enter your details into the `.env` file
|
||||
5. Execute `npm run dev`
|
||||
|
||||
@@ -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()}`;
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@ import React from 'react';
|
||||
|
||||
const Static = props => {
|
||||
return (
|
||||
<div className='page central'>
|
||||
<header>
|
||||
<h1 className="text centered">Privacy Policy</h1>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Static;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user