Update hosting path

This commit is contained in:
Felix Albrigtsen 2022-03-28 22:28:55 +02:00
parent 858d105bde
commit 30ab9da7b5
8 changed files with 14 additions and 15 deletions

View File

@ -1,2 +1,2 @@
REACT_APP_BACKEND_URL=https://asura.feal.no REACT_APP_API_URL=https://api.asura.feal.no
BROWSER=none BROWSER=none

View File

@ -4,6 +4,7 @@
"description": "DCST1008 Project - Server - Asura Tournament Management System", "description": "DCST1008 Project - Server - Asura Tournament Management System",
"author": "felixalb, kristoju, jonajha, krisleri", "author": "felixalb, kristoju, jonajha, krisleri",
"private": true, "private": true,
"homepage": ".",
"dependencies": { "dependencies": {
"@emotion/react": "^11.8.2", "@emotion/react": "^11.8.2",
"@emotion/styled": "^11.8.1", "@emotion/styled": "^11.8.1",

View File

@ -3,7 +3,6 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<meta <meta

View File

@ -75,7 +75,7 @@ function TournamentList() {
let [tournamentList, setTournamentList] = React.useState([]); let [tournamentList, setTournamentList] = React.useState([]);
React.useEffect(() => { React.useEffect(() => {
fetch(process.env.REACT_APP_BACKEND_URL + "/api/tournament/getTournaments") fetch(process.env.REACT_APP_API_URL + `/tournament/getTournaments`)
.then(res => res.json()) .then(res => res.json())
.then(data => { .then(data => {
if (data.status !== "OK") { if (data.status !== "OK") {

View File

@ -71,7 +71,7 @@ function Match(props) {
let formData = new FormData(); let formData = new FormData();
formData.append("winnerId",teamId); formData.append("winnerId",teamId);
let body = new URLSearchParams(formData); 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", method: "POST",
body: body body: body
}) })
@ -110,7 +110,7 @@ function BracketViewer(props) {
// One fetch statement for each of the three state variables // One fetch statement for each of the three state variables
React.useEffect(() => { 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(res => res.json())
.then(data => { .then(data => {
if (data.status !== "OK") { if (data.status !== "OK") {
@ -124,7 +124,7 @@ function BracketViewer(props) {
.catch(err => showError(err)); .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(res => res.json())
.then(data => { .then(data => {
if (data.status !== "OK") { if (data.status !== "OK") {
@ -149,7 +149,7 @@ function BracketViewer(props) {
}) })
.catch(err => showError(err)); .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(res => res.json())
.then(data=>{ .then(data=>{
if(data.status !== "OK"){ if(data.status !== "OK"){

View File

@ -22,7 +22,7 @@ function TeamCreator(props) {
formData.append("name", teamName); formData.append("name", teamName);
let body = new URLSearchParams(formData) 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", method: "POST",
body: body body: body
}) })
@ -103,7 +103,7 @@ function TeamEditor(props) {
setTeam({}); setTeam({});
return; 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(res => res.json())
.then(data => { .then(data => {
if (data.status !== "OK") { if (data.status !== "OK") {
@ -141,7 +141,7 @@ function TeamEditor(props) {
formData.append("name", team.name); formData.append("name", team.name);
console.log(team); console.log(team);
let body = new URLSearchParams(formData) 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", method: "POST",
body: body body: body
}) })
@ -178,7 +178,7 @@ export default function TournamentTeams(props) {
const { tournamentId } = useParams(); const { tournamentId } = useParams();
function getTeams() { 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((res) => res.json())
.then((data) => { .then((data) => {
if (data.status !== "OK") { if (data.status !== "OK") {

View File

@ -55,7 +55,7 @@ function submitTournament(event) {
formData.append("teamLimit", tournamentMaxTeams); formData.append("teamLimit", tournamentMaxTeams);
let body = new URLSearchParams(formData); 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", method: "POST",
body: body body: body
}) })

View File

@ -52,7 +52,7 @@ let submitChanges = curryTournamentId => event => {
// formData.append("teamLimit", tournamentMaxTeams); // formData.append("teamLimit", tournamentMaxTeams);
let body = new URLSearchParams(formData); 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", method: "POST",
body: body, body: body,
}) })
@ -73,8 +73,7 @@ function ManageTournament(props) {
React.useEffect(() => { React.useEffect(() => {
fetch( fetch(
process.env.REACT_APP_BACKEND_URL + process.env.REACT_APP_API_URL + `/tournament/${props.tournamentId}`
`/api/tournament/${props.tournamentId}`
) )
.then((res) => res.json()) .then((res) => res.json())
.then((data) => { .then((data) => {