From cf5a44d73c1da9c804615b6d7493aca3baebc92b Mon Sep 17 00:00:00 2001 From: Dario Date: Mon, 11 Mar 2024 22:47:44 +0100 Subject: [PATCH] Revert "fix: harcoded ip cause im tired" This reverts commit 5c0eefb057e0ddea495985409b767704714f8d96. --- webapp/src/components/auth/AuthUtils.js | 4 ++-- webapp/src/components/game/Logout.js | 2 +- webapp/src/components/game/Questions.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/webapp/src/components/auth/AuthUtils.js b/webapp/src/components/auth/AuthUtils.js index f33e134e..9da36bef 100644 --- a/webapp/src/components/auth/AuthUtils.js +++ b/webapp/src/components/auth/AuthUtils.js @@ -21,7 +21,7 @@ export function getLoginData() { export async function login(loginData, onSuccess, onError) { try { - let requestAnswer = await axios.post("http://98.66.168.12:8080" + "/auth/login", loginData); + let requestAnswer = await axios.post(process.env.REACT_APP_API_ENDPOINT + "/auth/login", loginData); if (HttpStatusCode.Ok === requestAnswer.status) { saveToken(requestAnswer); onSuccess(); @@ -35,7 +35,7 @@ export async function login(loginData, onSuccess, onError) { export async function register(registerData, onSuccess, onError) { try { - let requestAnswer = await axios.post("http://98.66.168.12:8080" + "/auth/register", registerData); + let requestAnswer = await axios.post(process.env.REACT_APP_API_ENDPOINT + "/auth/register", registerData); if (HttpStatusCode.Ok === requestAnswer.status) { saveToken(requestAnswer); onSuccess(); diff --git a/webapp/src/components/game/Logout.js b/webapp/src/components/game/Logout.js index 9f378628..e1044e57 100644 --- a/webapp/src/components/game/Logout.js +++ b/webapp/src/components/game/Logout.js @@ -2,7 +2,7 @@ import axios from "axios"; export async function logoutUser() { try { - await axios.get("http://98.66.168.12:8080" + "/auth/logout"); + await axios.get(process.env.REACT_APP_API_ENDPOINT + "/auth/logout"); sessionStorage.removeItem("jwtToken"); sessionStorage.removeItem("jwtRefreshToken"); } catch (error) { diff --git a/webapp/src/components/game/Questions.js b/webapp/src/components/game/Questions.js index b7c5c72b..32b6c239 100644 --- a/webapp/src/components/game/Questions.js +++ b/webapp/src/components/game/Questions.js @@ -2,7 +2,7 @@ import axios, { HttpStatusCode } from "axios"; export async function getQuestion() { try { - let requestAnswer = await axios.get("http://98.66.168.12:8080" + "/questions/new"); + let requestAnswer = await axios.get(process.env.REACT_APP_API_ENDPOINT + "/questions/new"); if (HttpStatusCode.Ok === requestAnswer.status) { return requestAnswer.data; } @@ -13,7 +13,7 @@ export async function getQuestion() { export async function answerQuestion(questionId, aId) { try { - let requestAnswer = await axios.post("http://98.66.168.12:8080" + "/questions/" + questionId + "/answer", {answer_id:aId}); + let requestAnswer = await axios.post(process.env.REACT_APP_API_ENDPOINT + "/questions/" + questionId + "/answer", {answer_id:aId}); if (HttpStatusCode.Ok === requestAnswer.status) { return requestAnswer.data; }