feat: implement EditProfile functionality with form validation and update user profile API integration

This commit is contained in:
2025-09-06 20:22:40 +02:00
parent fc7dacc6fb
commit 19520c832f
6 changed files with 345 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
import { getMe, getUserProfile, getUserThoughts } from "@/lib/api";
import { getMe, getUserProfile, getUserThoughts, Me } from "@/lib/api";
import { UserAvatar } from "@/components/user-avatar";
import { ThoughtCard } from "@/components/thought-card";
import { Calendar } from "lucide-react";
@@ -35,7 +35,7 @@ export default async function ProfilePage({ params }: ProfilePageProps) {
const user = userResult.value;
const thoughts =
thoughtsResult.status === "fulfilled" ? thoughtsResult.value.thoughts : [];
const me = meResult.status === "fulfilled" ? meResult.value : null;
const me = meResult.status === "fulfilled" ? (meResult.value as Me) : null;
// *** SIMPLIFIED LOGIC ***
// The follow status is now directly available from the `me` object.
@@ -104,6 +104,7 @@ export default async function ProfilePage({ params }: ProfilePageProps) {
key={thought.id}
thought={thought}
author={{ username: user.username, avatarUrl: user.avatarUrl }}
currentUser={me || null}
/>
))}
{thoughts.length === 0 && (