From a1977aaf7d5aaa92934292b47d3036cd1b4b5394 Mon Sep 17 00:00:00 2001
From: Vansh Chaurasiya <114163734+vansh-codes@users.noreply.github.com>
Date: Thu, 31 Oct 2024 00:34:01 +0530
Subject: [PATCH] Revert "Header, home icon, redirects to home page"
---
components/Home.jsx | 68 +++-----
src/app/[username]/page.jsx | 301 +++++++++++++++++-------------------
2 files changed, 158 insertions(+), 211 deletions(-)
diff --git a/components/Home.jsx b/components/Home.jsx
index 8b82ea3..94bd22c 100644
--- a/components/Home.jsx
+++ b/components/Home.jsx
@@ -1,9 +1,8 @@
-"use client";
+'use client';
import { useState } from "react";
import { useRouter } from "next/navigation";
-import toast, { Toaster } from "react-hot-toast";
+import toast, { Toaster } from 'react-hot-toast';
import Typewriter from "typewriter-effect";
-import Link from "next/link";
function Home() {
const [username, setUsername] = useState("");
@@ -13,15 +12,15 @@ function Home() {
e.preventDefault();
if (username.trim()) {
try {
- const response = await fetch("/api/user", {
- method: "POST",
+ const response = await fetch('/api/user', {
+ method: 'POST',
headers: {
- "Content-Type": "application/json",
+ 'Content-Type': 'application/json',
},
body: JSON.stringify({ username: username.trim() }),
});
- console.log(response);
+ console.log(response)
if (response.ok) {
const data = await response.json();
@@ -29,16 +28,16 @@ function Home() {
if (data.exists) {
router.push(`/${username.trim()}`);
} else {
- toast.error("Username does not exist on GitHub");
+ toast.error('Username does not exist on GitHub');
}
} else {
- toast.error("Error verifying username. Please try again.");
+ toast.error('Error verifying username. Please try again.');
}
} catch (error) {
- toast.error("An unexpected error occurred. Please try again.");
+ toast.error('An unexpected error occurred. Please try again.');
}
} else {
- toast.error("Please enter a username.");
+ toast.error('Please enter a username.');
}
};
@@ -47,24 +46,11 @@ function Home() {