hata ayıklama ve kod temizliği
This commit is contained in:
@@ -2,7 +2,7 @@ import { createClient } from "@/lib/supabase-server"
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
||||
import { UserForm } from "@/components/dashboard/user-form"
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { getProfile } from "@/lib/data"
|
||||
|
||||
export default async function ProfilePage() {
|
||||
@@ -23,9 +23,17 @@ export default async function ProfilePage() {
|
||||
return <div>Profil verisi bulunamadı.</div>
|
||||
}
|
||||
|
||||
const parts = (profile.full_name || "").split(' ')
|
||||
const firstName = parts[0] || ""
|
||||
const lastName = parts.slice(1).join(' ') || ""
|
||||
// Improved name parsing logic
|
||||
const fullName = (profile.full_name || "").trim()
|
||||
const firstSpaceIndex = fullName.indexOf(' ')
|
||||
|
||||
let firstName = fullName
|
||||
let lastName = ""
|
||||
|
||||
if (firstSpaceIndex > 0) {
|
||||
firstName = fullName.substring(0, firstSpaceIndex)
|
||||
lastName = fullName.substring(firstSpaceIndex + 1)
|
||||
}
|
||||
|
||||
const initialData = {
|
||||
firstName,
|
||||
|
||||
Reference in New Issue
Block a user