Skip to content

Commit

Permalink
use public URL in the react app
Browse files Browse the repository at this point in the history
  • Loading branch information
ntraut committed Jan 26, 2021
1 parent 7bc2b35 commit bc7de87
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/config/front.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = `
window._env_ = {
"PUBLIC_URL": "${process.env.PUBLIC_URL || ''}",
"API_URL": "${process.env.API_URL}",
"GITHUB_CLIENT_ID": "${process.env.GITHUB_CLIENT_ID}",
}
`;
2 changes: 1 addition & 1 deletion src/front/pages/login/github.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Github extends React.Component {
const { location, history } = this.props;
const params = new URLSearchParams(location.search);

const responses = await fetch(`${window._env_.API_URL}/api/auth`, {
const responses = await fetch(`${window._env_.PUBLIC_URL}/api/auth`, {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Expand Down
10 changes: 5 additions & 5 deletions src/front/services/api.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const listOfApplications = async () => {
return [];
}

const responses = await fetch(`${window._env_.API_URL}/api/application`, {
const responses = await fetch(`${window._env_.PUBLIC_URL}/api/application`, {
headers,
method: 'GET',
});
Expand All @@ -41,7 +41,7 @@ export const getApplication = async (appId) => {
}

const responses = await fetch(
`${window._env_.API_URL}/api/application/${appId}`,
`${window._env_.PUBLIC_URL}/api/application/${appId}`,
{
headers,
method: 'GET',
Expand All @@ -59,7 +59,7 @@ export const createApplication = async (newApplication) => {
return {};
}

const responses = await fetch(`${window._env_.API_URL}/api/application`, {
const responses = await fetch(`${window._env_.PUBLIC_URL}/api/application`, {
headers,
method: 'POST',
body: JSON.stringify(newApplication),
Expand All @@ -78,7 +78,7 @@ export const updateApplication = async (appId, application) => {
}

const responses = await fetch(
`${window._env_.API_URL}/api/application/${appId}`,
`${window._env_.PUBLIC_URL}/api/application/${appId}`,
{
headers,
method: 'PUT',
Expand All @@ -98,7 +98,7 @@ export const deleteUser = async () => {
return {};
}

const responses = await fetch(`${window._env_.API_URL}/api/developer`, {
const responses = await fetch(`${window._env_.PUBLIC_URL}/api/developer`, {
headers,
method: 'DELETE',
});
Expand Down

0 comments on commit bc7de87

Please sign in to comment.