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

@@ -75,14 +75,17 @@ export const rmFromRemove = (itemID: number) => {
export const createLoan = async (startDate: string, endDate: string) => {
const items = removeArr;
const response = await fetch("https://backend.insta.the1s.de/api/createLoan", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token") || ""}`,
},
body: JSON.stringify({ items, startDate, endDate }),
});
const response = await fetch(
"https://backend.insta.the1s.de/api/createLoan",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token") || ""}`,
},
body: JSON.stringify({ items, startDate, endDate }),
}
);
if (!response.ok) {
myToast("Fehler beim Erstellen der Ausleihe", "error");
@@ -122,12 +125,15 @@ export const onReturn = async (loanID: number) => {
};
export const onTake = async (loanID: number) => {
const response = await fetch(`https://backend.insta.the1s.de/api/takeLoan/${loanID}`, {
method: "POST",
headers: {
Authorization: `Bearer ${Cookies.get("token") || ""}`,
},
});
const response = await fetch(
`https://backend.insta.the1s.de/api/takeLoan/${loanID}`,
{
method: "POST",
headers: {
Authorization: `Bearer ${Cookies.get("token") || ""}`,
},
}
);
if (!response.ok) {
myToast("Fehler beim Ausleihen der Ausleihe", "error");
@@ -139,14 +145,17 @@ export const onTake = async (loanID: number) => {
};
export const changePW = async (oldPassword: string, newPassword: string) => {
const response = await fetch("http://localhost:8002/api/changePassword", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token") || ""}`,
},
body: JSON.stringify({ oldPassword, newPassword }),
});
const response = await fetch(
"https://backend.insta.the1s.de/api/changePassword",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token") || ""}`,
},
body: JSON.stringify({ oldPassword, newPassword }),
}
);
if (!response.ok) {
myToast("Fehler beim Ändern des Passworts", "error");