-
-
- Willkommen!
-Nutze die Filter rechts, um deine Auswahl einzugrenzen.
-
-
+ Filter
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Lade Elemente...
-
+
+
\ No newline at end of file
diff --git a/public/login.js b/public/login.js
index e69de29..f13b34d 100644
--- a/public/login.js
+++ b/public/login.js
@@ -0,0 +1,35 @@
+const form = document.getElementById("loginForm")
+const errorMessage = document.getElementById("errorMessage")
+
+form.addEventListener("submit", async (event) => {
+ event.preventDefault()
+
+ const username = document.getElementById("username").value
+ const password = document.getElementById("password").value
+
+ try {
+ const response = await fetch("/auth/login", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify({ username, password })
+ })
+
+ const data = await response.json()
+
+ if (!response.ok) {
+ errorMessage.textContent = data.message
+ return
+ }
+
+ // Token speichern
+ localStorage.setItem("token", data.token)
+
+ // Weiterleiten
+ window.location.href = "dashboard.html"
+
+ } catch (err) {
+ errorMessage.textContent = "Server nicht erreichbar"
+ }
+})
\ No newline at end of file
Dashboard
+Login erfolgreich 🎉
+