From ec400802d212d129ffebb371f32704c75fb628a1 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Sun, 14 Dec 2025 10:47:50 +0330 Subject: [PATCH] show true data profile --- src/app/[name]/(Profile)/profile/page.tsx | 48 ++++++++++++----------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/src/app/[name]/(Profile)/profile/page.tsx b/src/app/[name]/(Profile)/profile/page.tsx index 64378d3..fe0c66b 100644 --- a/src/app/[name]/(Profile)/profile/page.tsx +++ b/src/app/[name]/(Profile)/profile/page.tsx @@ -3,27 +3,32 @@ import Button from '@/components/button/PrimaryButton'; // import { useProfile } from '@/hooks/auth/useProfile'; // import { useAuthStore } from '@/zustand/authStore'; -import { ArrowLeft, Calendar2, CallCalling, Profile, Sms, Verify } from 'iconsax-react'; +import { ArrowLeft, Calendar2, CallCalling, Profile } from 'iconsax-react'; import Image from 'next/image'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import React from 'react' +import { useGetProfile } from './hooks/userProfileData'; type Props = object function ProfileIndex({ }: Props) { + const router = useRouter(); + const { data, isPending } = useGetProfile(); - // const isAuthenticated = useAuthStore((state) => state.isAuthenticated); + const formatDate = (dateString: string): string => { + const date = new Date(dateString); + return date.toLocaleDateString('fa-IR', { + year: 'numeric', + month: 'numeric', + day: 'numeric' + }); + }; - // const { mutate, data, isPending } = useProfile(); - - // useEffect(() => { - // if (isAuthenticated) { - // mutate(); - // } - // // eslint-disable-next-line react-hooks/exhaustive-deps - // }, [isAuthenticated]) + const userData = data?.data; + const fullName = userData ? `${userData.firstName} ${userData.lastName}` : ''; + const genderText = userData?.gender ? 'آقا' : 'خانوم'; return (
@@ -50,14 +55,16 @@ function ProfileIndex({ }: Props) { height={80} />
-
علیرضا عابدزاده
-
+
+ {isPending ? 'در حال بارگذاری...' : fullName || '-'} +
+ {/*
شناسه کاربری: - 2162165 -
+ {isPending ? '...' : userData?.id || '-'} +
*/}
@@ -65,22 +72,19 @@ function ProfileIndex({ }: Props) {
شماره همراه: - 09010901738 -
-
- - ایمیل: - alirezaabed@gmail.com + {isPending ? '...' : userData?.phone || '-'}
تاریخ تولد: - 1375/5/14 + + {isPending ? '...' : (userData?.birthDate ? formatDate(userData.birthDate) : '-')} +
جنسیت: - آقا + {isPending ? '...' : genderText}