update bugs

This commit is contained in:
Phil Leon Kersting
2025-07-24 17:30:05 +02:00
parent 6da6693c17
commit a80720fe5f
9 changed files with 232 additions and 61 deletions

View File

@@ -12,16 +12,6 @@ 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", {
method: "GET",
headers: {
Authorization: `Bearer ${Cookies.get("token")}`,
},
})
.then((res) => res.json())
.then((users) => {
localStorage.setItem("users", JSON.stringify(users));
});
myToast("Logged in successfully!", "success");
} else if (response.status === 401) {
myToast("Invalid username or password!", "error");