diff --git a/client/components/pages/account.jsx b/client/components/pages/account.jsx
index a529a45..fe947ea 100644
--- a/client/components/pages/account.jsx
+++ b/client/components/pages/account.jsx
@@ -21,7 +21,7 @@ const Account = props => {
//grab the user's info
useEffect(() => {
- authTokens.tokenFetch(`${process.env.AUTH_URI}/account`, {
+ authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/account`, {
method: 'GET',
headers: {
'Access-Control-Allow-Origin': '*'
@@ -83,7 +83,7 @@ const update = async (password, retype, contact, tokenFetch) => {
return ['Password is too short'];
}
- const result = await tokenFetch(`${process.env.AUTH_URI}/update`, {
+ const result = await tokenFetch(`${process.env.AUTH_URI}/auth/account`, {
method: 'PATCH',
headers: {
'Access-Control-Allow-Origin': '*',
diff --git a/client/components/pages/homepage.jsx b/client/components/pages/homepage.jsx
index 28380c0..66d0cc8 100644
--- a/client/components/pages/homepage.jsx
+++ b/client/components/pages/homepage.jsx
@@ -6,7 +6,7 @@ const HomePage = props => {
return (
This is the MERN template homepage.
-
+
);
};
diff --git a/client/components/pages/login.jsx b/client/components/pages/login.jsx
index 9bb6a31..d24fc6a 100644
--- a/client/components/pages/login.jsx
+++ b/client/components/pages/login.jsx
@@ -66,7 +66,7 @@ const handleSubmit = async (email, password) => {
}
//send to the auth server
- const result = await fetch(`${process.env.AUTH_URI}/login`, {
+ const result = await fetch(`${process.env.AUTH_URI}/auth/login`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
diff --git a/client/components/pages/signup.jsx b/client/components/pages/signup.jsx
index 3306eea..46b9203 100644
--- a/client/components/pages/signup.jsx
+++ b/client/components/pages/signup.jsx
@@ -82,7 +82,7 @@ const handleSubmit = async (email, username, password, retype, contact) => {
}
//send to the auth server
- const result = await fetch(`${process.env.AUTH_URI}/signup`, {
+ const result = await fetch(`${process.env.AUTH_URI}/auth/signup`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
diff --git a/client/components/panels/delete-account.jsx b/client/components/panels/delete-account.jsx
index f56ebfa..deffa43 100644
--- a/client/components/panels/delete-account.jsx
+++ b/client/components/panels/delete-account.jsx
@@ -33,7 +33,7 @@ const DeleteAccount = props => {
const handleSubmit = async (password, authTokens) => {
//schedule a deletion
- const result = await authTokens.tokenFetch(`${process.env.AUTH_URI}/deletion`, {
+ const result = await authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/account`, {
method: 'DELETE',
headers: {
'Access-Control-Allow-Origin': '*',
@@ -49,7 +49,7 @@ const handleSubmit = async (password, authTokens) => {
}
//force a logout
- const result2 = await authTokens.tokenFetch(`${process.env.AUTH_URI}/logout`, {
+ const result2 = await authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/logout`, {
method: 'DELETE',
headers: {
'Access-Control-Allow-Origin': '*',
diff --git a/client/components/panels/header.jsx b/client/components/panels/header.jsx
index 430df8d..3f5166b 100644
--- a/client/components/panels/header.jsx
+++ b/client/components/panels/header.jsx
@@ -31,7 +31,7 @@ const Member = () => {
{ /* Logout button logs you out of the server too */ }
{
- const result = await authTokens.tokenFetch(`${process.env.AUTH_URI}/logout`, { //NOTE: this gets overwritten as a bugfix
+ const result = await authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/logout`, { //NOTE: this gets overwritten as a bugfix
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
diff --git a/client/components/panels/news-editor.jsx b/client/components/panels/news-editor.jsx
index e2af6aa..4325586 100644
--- a/client/components/panels/news-editor.jsx
+++ b/client/components/panels/news-editor.jsx
@@ -18,7 +18,7 @@ const NewsEditor = props => {
//run once
useEffect(async () => {
- const result = await fetch(`${process.env.NEWS_URI}/metadata?limit=999`, {
+ const result = await fetch(`${process.env.NEWS_URI}/news/metadata?limit=999`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@@ -46,7 +46,7 @@ const NewsEditor = props => {
//fetch this article
const index = values[0].value;
- const result = await fetch(`${process.env.NEWS_URI}/archive/${index}`, {
+ const result = await fetch(`${process.env.NEWS_URI}/news/archive/${index}`, {
headers: {
'Access-Control-Allow-Origin': '*'
}
@@ -119,7 +119,7 @@ const handleSubmit = async (title, author, body, index, tokenFetch) => {
body = body.trim();
//fetch POST json data
- const result = await tokenFetch(`${process.env.NEWS_URI}/${index}`, {
+ const result = await tokenFetch(`${process.env.NEWS_URI}/news/${index}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
@@ -143,7 +143,7 @@ const handleDelete = async (index, tokenFetch) => {
const conf = confirm('Are you sure you want to delete this article?');
if (conf) {
- const result = await tokenFetch(`${process.env.NEWS_URI}/${index}`, {
+ const result = await tokenFetch(`${process.env.NEWS_URI}/news/${index}`, {
method: 'DELETE'
});
diff --git a/client/components/panels/news-feed.jsx b/client/components/panels/news-feed.jsx
index 7a3e28e..55ffa1d 100644
--- a/client/components/panels/news-feed.jsx
+++ b/client/components/panels/news-feed.jsx
@@ -6,7 +6,7 @@ const NewsFeed = props => {
const [articles, setArticles] = useState([]);
useEffect(async () => {
- const result = await fetch(props.uri, {
+ const result = await fetch(`${process.env.NEWS_URI}/news`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
diff --git a/client/components/panels/news-publisher.jsx b/client/components/panels/news-publisher.jsx
index 9847689..8db99e9 100644
--- a/client/components/panels/news-publisher.jsx
+++ b/client/components/panels/news-publisher.jsx
@@ -53,7 +53,7 @@ const handleSubmit = async (title, author, body, tokenFetch) => {
//fetch POST json data
const result = await tokenFetch(
- `${process.env.NEWS_URI}`,
+ `${process.env.NEWS_URI}/news`,
{
method: 'POST',
headers: {
diff --git a/client/components/panels/privilege-editor.jsx b/client/components/panels/privilege-editor.jsx
index bec0868..f8ba9b4 100644
--- a/client/components/panels/privilege-editor.jsx
+++ b/client/components/panels/privilege-editor.jsx
@@ -46,7 +46,7 @@ const PrivilegeEditor = props => {
};
const handleSubmit = async (username, privilege, tokenFetch) => {
- const result = await tokenFetch(`${process.env.AUTH_URI}/account/privilege`, {
+ const result = await tokenFetch(`${process.env.AUTH_URI}/admin/privilege`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
diff --git a/client/components/utilities/token-provider.jsx b/client/components/utilities/token-provider.jsx
index fdea3df..1df6d0f 100644
--- a/client/components/utilities/token-provider.jsx
+++ b/client/components/utilities/token-provider.jsx
@@ -28,7 +28,7 @@ const TokenProvider = props => {
if (expired) {
//ping the auth server for a new token
- const response = await fetch(`${process.env.AUTH_URI}/token`, {
+ const response = await fetch(`${process.env.AUTH_URI}/auth/token`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -52,8 +52,8 @@ const TokenProvider = props => {
bearer = newAuth.accessToken;
//BUGFIX: logging out correctly requires the new refresh token
- if (url == `${process.env.AUTH_URI}/logout`) {
- return fetch(`${process.env.AUTH_URI}/logout`, {
+ if (url == `${process.env.AUTH_URI}/auth/logout`) {
+ return fetch(`${process.env.AUTH_URI}/auth/logout`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
diff --git a/configure-script.js b/configure-script.js
index 6ad9a4c..b6b696f 100644
--- a/configure-script.js
+++ b/configure-script.js
@@ -124,8 +124,8 @@ services:
- DB_USERNAME=${projectDBUser}
- DB_PASSWORD=${projectDBPass}
- DB_TIMEZONE=${dbTimeZone}
- - NEWS_URI=https://${newsWebAddress}/news
- - AUTH_URI=https://${authWebAddress}/auth
+ - NEWS_URI=https://${newsWebAddress}
+ - AUTH_URI=https://${authWebAddress}
- SECRET_ACCESS=${accessToken}
networks:
- app-network
diff --git a/webpack.config.js b/webpack.config.js
index 18bac99..252f764 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -51,9 +51,9 @@ module.exports = ({ production, analyzer }) => {
new DefinePlugin({
'process.env': {
'PRODUCTION': production,
- 'NEWS_URI': production ? `"${process.env.NEWS_URI}"` : '"https://dev-news.eggtrainer.com/news"',
- 'AUTH_URI': production ? `"${process.env.AUTH_URI}"` : '"https://dev-auth.eggtrainer.com/auth"',
-// 'CHAT_URI': production ? `"${process.env.CHAT_URI}"` : '"https://dev-chat.eggtrainer.com/chat"',
+ 'NEWS_URI': production ? `"${process.env.NEWS_URI}"` : '"https://dev-news.eggtrainer.com"',
+ 'AUTH_URI': production ? `"${process.env.AUTH_URI}"` : '"https://dev-auth.eggtrainer.com"',
+// 'CHAT_URI': production ? `"${process.env.CHAT_URI}"` : '"https://dev-chat.eggtrainer.com"',
}
}),
new CleanWebpackPlugin({