added comprehensive ports for networking

This commit is contained in:
2025-07-25 11:59:33 +02:00
parent fcb8af574c
commit 7f74a740ae
5 changed files with 48 additions and 31 deletions

View File

@@ -18,7 +18,7 @@ const LoginCard: React.FC<LoginCardProps> = ({ onClose, changeAuth }) => {
e.preventDefault();
setError("");
try {
const response = await fetch("http://localhost:5002/api/login", {
const response = await fetch("http://45.133.75.67/:5002/api/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username, password }),

View File

@@ -33,7 +33,7 @@ export function useUsers(): UserReturn {
const fetchUsers = async () => {
try {
const response = await fetch("http://localhost:5002/api/getAllUsers", {
const response = await fetch("http://45.133.75.67:5002/api/getAllUsers", {
method: "GET",
headers: headers,
});
@@ -50,7 +50,7 @@ export function useUsers(): UserReturn {
};
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: {
@@ -109,7 +109,7 @@ export function useUsers(): UserReturn {
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: {

View File

@@ -6,7 +6,7 @@ export const loginUser = async (
password: string
): Promise<boolean> => {
try {
const response = await fetch("http://localhost:5002/api/login", {
const response = await fetch("http://45.133.75.67:5002/api/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username, password }),
@@ -31,7 +31,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: {
@@ -53,7 +53,7 @@ export const deleteUser = (id: number) => {
export const replaceUsers = async () => {
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")}`,
@@ -104,7 +104,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: {