mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2026-01-05 22:24:06 +01:00
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { createSupabaseClient } from "@/lib/supabase/serverComponentClient";
|
|
import { getUserProfile } from "@/lib/data/userQuery";
|
|
import { notFound } from "next/navigation";
|
|
import EditProfileForm from "./EditProfileForm";
|
|
|
|
type ProfilePageProps = {
|
|
params: { uid: string };
|
|
};
|
|
|
|
export default async function ProfilePage({ params }: ProfilePageProps) {
|
|
const uid = params.uid;
|
|
const client = createSupabaseClient();
|
|
const {
|
|
data: { user },
|
|
} = await client.auth.getUser();
|
|
|
|
if (!user || user?.id !== uid) {
|
|
notFound();
|
|
}
|
|
|
|
const { data: profileData, error } = await getUserProfile(client, uid);
|
|
|
|
if (error || !profileData) {
|
|
return (
|
|
<div className="flex items-center justify-center h-screen">
|
|
<p>Error loading profile data. Please try again later.</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="container max-w-screen-xl">
|
|
<div className="my-5">
|
|
<span className="text-2xl font-bold">Update Profile</span>
|
|
</div>
|
|
<EditProfileForm profileData={profileData} uid={uid} sessionUserId={user.id} />
|
|
</div>
|
|
);
|
|
}
|