feat: update server URL and enhance Docker configuration with user frontends

This commit is contained in:
2025-07-24 19:43:10 +02:00
parent 850c475329
commit e98c6474f0
5 changed files with 91 additions and 31 deletions

View File

@@ -1 +1 @@
REACT_APP_SERVER_URL=http://localhost:5002
REACT_APP_SERVER_URL=http://45.133.75.67/

View File

@@ -2,7 +2,7 @@ import Cookies from "js-cookie";
import { myToast } from "./frontendService";
export const loginUser = (username: string, password: string) => {
fetch(`http://localhost:5002/api/login`, {
fetch(`http://45.133.75.67:5002/api/login`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username, password }),
@@ -12,7 +12,7 @@ export const loginUser = (username: string, password: string) => {
const data = await response.json();
Cookies.set("token", data.token, { expires: 7 });
Cookies.set("name", data.user.first_name, { expires: 7 });
await fetch("http://localhost:5002/api/getAllUsers", {
await fetch("http://45.133.75.67:5002/api/getAllUsers", {
method: "GET",
headers: {
Authorization: `Bearer ${Cookies.get("token")}`,
@@ -42,7 +42,7 @@ export const logout = () => {
};
export const deleteUser = (id: number) => {
fetch("http://localhost:5002/api/deleteUser", {
fetch("http://45.133.75.67:5002/api/deleteUser", {
method: "POST",
body: JSON.stringify({ id: id }),
headers: {
@@ -64,7 +64,7 @@ export const deleteUser = (id: number) => {
export const replaceUsers = async (alertMessage: string) => {
localStorage.removeItem("users");
await fetch("http://localhost:5002/api/getAllUsers", {
await fetch("http://45.133.75.67:5002/api/getAllUsers", {
method: "GET",
headers: {
Authorization: `Bearer ${Cookies.get("token")}`,
@@ -115,7 +115,7 @@ export const updateUserFunc = async (userID: number) => {
console.log("Sending user data:", userData);
try {
const response = await fetch("http://localhost:5002/api/updateUser", {
const response = await fetch("http://45.133.75.67:5002/api/updateUser", {
method: "POST",
body: JSON.stringify(userData),
headers: {