From 7a617ea275e98b38e08629a9eaa447872d4b41b2 Mon Sep 17 00:00:00 2001 From: GamerBoss101 Date: Sun, 13 Apr 2025 03:35:09 -0400 Subject: [PATCH] Profile Page Update --- public/{ => avatar}/p1.png | Bin src/app/(app)/profile/page.tsx | 55 ++++++++++++++++++++++++++++----- src/app/api/me/route.ts | 32 +++++++++++++++++++ 3 files changed, 79 insertions(+), 8 deletions(-) rename public/{ => avatar}/p1.png (100%) create mode 100644 src/app/api/me/route.ts diff --git a/public/p1.png b/public/avatar/p1.png similarity index 100% rename from public/p1.png rename to public/avatar/p1.png diff --git a/src/app/(app)/profile/page.tsx b/src/app/(app)/profile/page.tsx index 84ca117..12cdef2 100644 --- a/src/app/(app)/profile/page.tsx +++ b/src/app/(app)/profile/page.tsx @@ -1,12 +1,31 @@ "use client"; -import React from "react"; +import { useEffect, useState } from "react"; import { useDevice } from "@/lib/context/DeviceContext"; -import { useRouter } from "next/navigation"; -export default function ProfilePage() { +function Mobile() { const { isAuthenticated, session } = useDevice(); + const [bio, setBio] = useState(""); + + function handleBioSubmit(e: React.FormEvent) { + e.preventDefault(); + if (bio.length > 0) { + const formData = new FormData(); + formData.append("bio", bio); + + fetch("/api/me", { + method: "POST", + body: formData, // Automatically sets Content-Type to multipart/form-data + }); + + // Show a success message + alert("Bio saved!"); + } else { + alert("Please enter a bio."); + } + } + return (
@@ -17,7 +36,7 @@ export default function ProfilePage() {
{isAuthenticated && ( Profile Preview @@ -28,12 +47,11 @@ export default function ProfilePage() {
- {/*

{bio || "No bio yet..."}

+

{bio || "No bio yet..."}