From e417f3fc89ec2d5d95c31488cbc1c71adef12e9e Mon Sep 17 00:00:00 2001
From: DeenuRSD <124046429+DeenuRSD@users.noreply.github.com>
Date: Sat, 19 Oct 2024 02:42:48 +0530
Subject: [PATCH] Update index.html
---
index.html | 445 ++++++++++-------------------------------------------
1 file changed, 84 insertions(+), 361 deletions(-)
diff --git a/index.html b/index.html
index fc49ab1..9012189 100644
--- a/index.html
+++ b/index.html
@@ -1,369 +1,92 @@
-
-
-
- Badge Website
+
+
+
+ Login and SignUp
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
Login
+
-
-
-
-
-
-
Season of AI | Beginner AI Learner
-
Awarded to: hello.rajat.rajput@gmail.com
-
- Issued on: Jul 28, 2024 at
- 1:11 AM
-
-
-
-
-
Share your badge:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Season of AI | Intermediate AI Learner
-
Awarded to: example.user@example.com
-
- Issued on: Sep 17, 2024 at
- 3:55 PM
-
-
-
-
-
Share your badge:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Season of AI | Intermediate AI Learner
-
Awarded to: example.user@example.com
-
- Issued on: Sep 17, 2024 at
- 3:55 PM
-
-
-
-
-
Share your badge:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Season of AI | Intermediate AI Learner
-
Awarded to: example.user@example.com
-
- Issued on: Sep 17, 2024 at
- 3:55 PM
-
-
-
-
-
Share your badge:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Season of AI | Intermediate AI Learner
-
Awarded to: example.user@example.com
-
- Issued on: Sep 17, 2024 at
- 3:55 PM
-
-
-
-
-
Share your badge:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Season of AI | Advance AI Learner
-
Awarded to: example.user@example.com
-
- Issued on: Dec 17, 2024 at
- 8:55 PM
-
-
-
-
-
Share your badge:
-
-
-
-
-
-
-
-
-
-
-
-
-
+
Sign Up
+
+
-
+
-
-
+ const response = await fetch("http://localhost:3000/api/signup", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ username, password }),
+ });
-
-
-
+ const data = await response.json();
+ alert(data.message || data.error);
+ });
+
+ // Handle Login
+ document.getElementById("loginForm").addEventListener("submit", async (e) => {
+ e.preventDefault();
+ const username = document.getElementById("loginUsername").value;
+ const password = document.getElementById("loginPassword").value;
+
+ const response = await fetch("http://localhost:3000/api/login", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ username, password }),
+ });
+
+ const data = await response.json();
+ alert(data.token ? "Login successful!" : data.error);
+ });
+
+
+