From 30ab9da7b52c6cc9c7950216cce7ebdf84bfe7e1 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Mon, 28 Mar 2022 22:28:55 +0200 Subject: [PATCH] Update hosting path --- src/client/.env | 2 +- src/client/package.json | 1 + src/client/public/index.html | 1 - src/client/src/FrontPage.js | 2 +- src/client/src/TournamentOverview.js | 8 ++++---- src/client/src/TournamentTeams.js | 8 ++++---- src/client/src/createtournament.js | 2 +- src/client/src/managetournament.js | 5 ++--- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/client/.env b/src/client/.env index 182f235..0fcd09e 100644 --- a/src/client/.env +++ b/src/client/.env @@ -1,2 +1,2 @@ -REACT_APP_BACKEND_URL=https://asura.feal.no +REACT_APP_API_URL=https://api.asura.feal.no BROWSER=none \ No newline at end of file diff --git a/src/client/package.json b/src/client/package.json index 3341ffb..8382777 100644 --- a/src/client/package.json +++ b/src/client/package.json @@ -4,6 +4,7 @@ "description": "DCST1008 Project - Server - Asura Tournament Management System", "author": "felixalb, kristoju, jonajha, krisleri", "private": true, + "homepage": ".", "dependencies": { "@emotion/react": "^11.8.2", "@emotion/styled": "^11.8.1", diff --git a/src/client/public/index.html b/src/client/public/index.html index 67c889b..c1d44de 100644 --- a/src/client/public/index.html +++ b/src/client/public/index.html @@ -3,7 +3,6 @@ - { - fetch(process.env.REACT_APP_BACKEND_URL + "/api/tournament/getTournaments") + fetch(process.env.REACT_APP_API_URL + `/tournament/getTournaments`) .then(res => res.json()) .then(data => { if (data.status !== "OK") { diff --git a/src/client/src/TournamentOverview.js b/src/client/src/TournamentOverview.js index 5092ed7..a779039 100644 --- a/src/client/src/TournamentOverview.js +++ b/src/client/src/TournamentOverview.js @@ -71,7 +71,7 @@ function Match(props) { let formData = new FormData(); formData.append("winnerId",teamId); let body = new URLSearchParams(formData); - fetch(process.env.REACT_APP_BACKEND_URL + `/api/match/${props.match.id}/setWinner`, { + fetch(process.env.REACT_APP_API_URL + `/match/${props.match.id}/setWinner`, { method: "POST", body: body }) @@ -110,7 +110,7 @@ function BracketViewer(props) { // One fetch statement for each of the three state variables React.useEffect(() => { - fetch(process.env.REACT_APP_BACKEND_URL + `/api/tournament/${props.tournamentId}`) + fetch(process.env.REACT_APP_API_URL + `/tournament/${props.tournamentId}`) .then(res => res.json()) .then(data => { if (data.status !== "OK") { @@ -124,7 +124,7 @@ function BracketViewer(props) { .catch(err => showError(err)); - fetch(process.env.REACT_APP_BACKEND_URL + `/api/tournament/${props.tournamentId}/getMatches`) + fetch(process.env.REACT_APP_API_URL + `/tournament/${props.tournamentId}/getMatches`) .then(res => res.json()) .then(data => { if (data.status !== "OK") { @@ -149,7 +149,7 @@ function BracketViewer(props) { }) .catch(err => showError(err)); - fetch(process.env.REACT_APP_BACKEND_URL + `/api/tournament/${props.tournamentId}/getTeams`) + fetch(process.env.REACT_APP_API_URL + `/tournament/${props.tournamentId}/getTeams`) .then(res => res.json()) .then(data=>{ if(data.status !== "OK"){ diff --git a/src/client/src/TournamentTeams.js b/src/client/src/TournamentTeams.js index 665886d..1d2ebc7 100644 --- a/src/client/src/TournamentTeams.js +++ b/src/client/src/TournamentTeams.js @@ -22,7 +22,7 @@ function TeamCreator(props) { formData.append("name", teamName); let body = new URLSearchParams(formData) - fetch(process.env.REACT_APP_BACKEND_URL + `/api/tournament/${props.tournamentId}/createTeam`, { + fetch(process.env.REACT_APP_API_URL + `/tournament/${props.tournamentId}/createTeam`, { method: "POST", body: body }) @@ -103,7 +103,7 @@ function TeamEditor(props) { setTeam({}); return; } - fetch(process.env.REACT_APP_BACKEND_URL + `/api/team/${props.selectedTeamId}`) + fetch(process.env.REACT_APP_API_URL + `/team/${props.selectedTeamId}`) .then(res => res.json()) .then(data => { if (data.status !== "OK") { @@ -141,7 +141,7 @@ function TeamEditor(props) { formData.append("name", team.name); console.log(team); let body = new URLSearchParams(formData) - fetch(process.env.REACT_APP_BACKEND_URL + `/api/team/${team.id}/edit`, { + fetch(process.env.REACT_APP_API_URL + `/team/${team.id}/edit`, { method: "POST", body: body }) @@ -178,7 +178,7 @@ export default function TournamentTeams(props) { const { tournamentId } = useParams(); function getTeams() { - fetch(process.env.REACT_APP_BACKEND_URL + `/api/tournament/${tournamentId}/getTeams`) + fetch(process.env.REACT_APP_API_URL + `/tournament/${tournamentId}/getTeams`) .then((res) => res.json()) .then((data) => { if (data.status !== "OK") { diff --git a/src/client/src/createtournament.js b/src/client/src/createtournament.js index 56fab08..404aa69 100644 --- a/src/client/src/createtournament.js +++ b/src/client/src/createtournament.js @@ -55,7 +55,7 @@ function submitTournament(event) { formData.append("teamLimit", tournamentMaxTeams); let body = new URLSearchParams(formData); - fetch(process.env.REACT_APP_BACKEND_URL + "/api/tournament/create", { + fetch(process.env.REACT_APP_API_URL + `/tournament/create`, { method: "POST", body: body }) diff --git a/src/client/src/managetournament.js b/src/client/src/managetournament.js index f0db48b..d6edd6e 100644 --- a/src/client/src/managetournament.js +++ b/src/client/src/managetournament.js @@ -52,7 +52,7 @@ let submitChanges = curryTournamentId => event => { // formData.append("teamLimit", tournamentMaxTeams); let body = new URLSearchParams(formData); - fetch(process.env.REACT_APP_BACKEND_URL + `/api/tournament/${tournamentId}/edit`, { + fetch(process.env.REACT_APP_API_URL + `/tournament/${tournamentId}/edit`, { method: "POST", body: body, }) @@ -73,8 +73,7 @@ function ManageTournament(props) { React.useEffect(() => { fetch( - process.env.REACT_APP_BACKEND_URL + - `/api/tournament/${props.tournamentId}` + process.env.REACT_APP_API_URL + `/tournament/${props.tournamentId}` ) .then((res) => res.json()) .then((data) => {