@@ -29,6 +29,8 @@ export default async function citizenSinglePage({
2929 }
3030
3131 const profileData = await getUserData ( ) ;
32+ console . log ( 'profileData123' , profileData . data ) ;
33+
3234
3335
3436
@@ -74,8 +76,13 @@ export default async function citizenSinglePage({
7476
7577 //to make description less than 200 character
7678 async function makeLessCharacter ( ) {
77- let temp = profileData . data . customs . about
78- temp = temp . slice ( 0 , 200 )
79+ let temp ;
80+ if ( profileData . data ?. customs ?. about ) {
81+ temp = profileData . data . customs . about
82+ temp = temp . slice ( 0 , 200 )
83+ } else (
84+ temp = ""
85+ )
7986 return temp
8087 }
8188
@@ -87,7 +94,7 @@ export default async function citizenSinglePage({
8794 return item . url
8895 } ) ,
8996 "url" : `http://rgb.irpsc.com/fa/citizen/${ params . id } ` ,
90- "jobTitle" : `${ profileData . data . customs . occupation } ` ,
97+ "jobTitle" : `${ profileData . data ? .customs ? .occupation } ` ,
9198 "description" : `${ await makeLessCharacter ( ) } ` ,
9299 "birthDate" : `${ profileData . data . kyc . birth_date } ` ,
93100 "email" : `${ profileData . data . kyc . email } ` ,
@@ -222,8 +229,13 @@ export async function generateMetadata({ params }) {
222229
223230 //to make description less than 200 character
224231 async function makeLessCharacter ( ) {
225- let temp = profileData . data . customs . about
226- temp = temp . slice ( 0 , 200 )
232+ let temp ;
233+ if ( profileData . data ?. customs ?. about ) {
234+ temp = profileData . data . customs . about
235+ temp = temp . slice ( 0 , 200 )
236+ } else (
237+ temp = ""
238+ )
227239 return temp
228240 }
229241
0 commit comments