changed urls

This commit is contained in:
2025-09-03 14:54:20 +02:00
parent b36f1ba9ba
commit d18465ff1d
2 changed files with 64 additions and 46 deletions

View File

@@ -54,14 +54,17 @@ export const createUser = async (
password: string
) => {
try {
const response = await fetch(`https://backend.insta.the1s.de/api/createUser`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token")}`,
},
body: JSON.stringify({ username, role, password }),
});
const response = await fetch(
`https://backend.insta.the1s.de/api/createUser`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token")}`,
},
body: JSON.stringify({ username, role, password }),
}
);
if (!response.ok) {
throw new Error("Failed to create user");
}
@@ -74,14 +77,17 @@ export const createUser = async (
export const changePW = async (newPassword: string, username: string) => {
try {
const response = await fetch(`http://localhost:8002/api/changePWadmin`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token")}`,
},
body: JSON.stringify({ newPassword, username }),
});
const response = await fetch(
`https://backend.insta.the1s.de/api/changePWadmin`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token")}`,
},
body: JSON.stringify({ newPassword, username }),
}
);
if (!response.ok) {
throw new Error("Failed to change password");
}
@@ -139,14 +145,17 @@ export const createItem = async (
can_borrow_role: number
) => {
try {
const response = await fetch(`https://backend.insta.the1s.de/api/createItem`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token")}`,
},
body: JSON.stringify({ item_name, can_borrow_role }),
});
const response = await fetch(
`https://backend.insta.the1s.de/api/createItem`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token")}`,
},
body: JSON.stringify({ item_name, can_borrow_role }),
}
);
if (!response.ok) {
throw new Error("Failed to create item");
}