diff --git a/frontend/src/config.ts b/frontend/src/config.ts deleted file mode 100644 index 69937c0a..00000000 --- a/frontend/src/config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const USER_API_URL = "http://localhost:3001/user"; -export const ASSIGNMENT_API_URL = "http://localhost:8080/assignment/api"; -export const GRADING_API_URL = "http://localhost:8088/grading/api"; diff --git a/frontend/src/helpers/assignment-service/api-wrapper.ts b/frontend/src/helpers/assignment-service/api-wrapper.ts index 684d0354..41bc95c3 100644 --- a/frontend/src/helpers/assignment-service/api-wrapper.ts +++ b/frontend/src/helpers/assignment-service/api-wrapper.ts @@ -1,9 +1,10 @@ import HttpStatusCode from "@/types/HttpStatusCode"; import axios, { AxiosError } from "axios"; -import { ASSIGNMENT_API_URL } from "@/config"; +const url = process.env.NEXT_PUBLIC_URL ?? "http://localhost:8080"; +const apiUrl = url + "/assignment/api"; const api = axios.create({ - baseURL: ASSIGNMENT_API_URL, + baseURL: apiUrl, timeout: 5000, headers: { "Content-type": "application/json", diff --git a/frontend/src/helpers/grading-service/api-wrapper.ts b/frontend/src/helpers/grading-service/api-wrapper.ts index 9921f82c..7ccdfad1 100644 --- a/frontend/src/helpers/grading-service/api-wrapper.ts +++ b/frontend/src/helpers/grading-service/api-wrapper.ts @@ -1,9 +1,10 @@ import HttpStatusCode from "@/types/HttpStatusCode"; import axios, { AxiosError } from "axios"; -import { GRADING_API_URL } from "@/config"; +const url = process.env.NEXT_PUBLIC_URL ?? "http://localhost:8088"; +const apiUrl = url + "/grading/api"; const api = axios.create({ - baseURL: GRADING_API_URL, + baseURL: apiUrl, timeout: 10000, headers: { "Content-type": "application/json", diff --git a/frontend/src/helpers/user-service/api-wrapper.ts b/frontend/src/helpers/user-service/api-wrapper.ts index 4a4bb84b..fbf62d6e 100644 --- a/frontend/src/helpers/user-service/api-wrapper.ts +++ b/frontend/src/helpers/user-service/api-wrapper.ts @@ -1,9 +1,10 @@ import axios, { isAxiosError } from "axios"; import HttpStatusCode from "@/types/HttpStatusCode"; -import { USER_API_URL } from "@/config"; +const url = process.env.NEXT_PUBLIC_URL ?? "http://localhost:3001"; +const apiUrl = url + "/user"; const api = axios.create({ - baseURL: USER_API_URL, + baseURL: apiUrl, timeout: 5000, headers: { "Content-type": "application/json",