This repository was archived by the owner on May 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,16 @@ const DetailGiftScreen = () => {
3838
3939 useEffect ( ( ) => {
4040 const fetchRecipientName = async ( ) => {
41- const name = await findRecipientById ( Number ( recipient ) ) ;
42- setRecipientName ( name ) ;
41+ try {
42+ const recipientData = await findRecipientById ( Number ( recipient ) ) ;
43+ if ( recipientData ) {
44+ setRecipientName ( recipientData . name ) ;
45+ } else {
46+ console . error ( 'Recipient not found' ) ;
47+ }
48+ } catch ( error ) {
49+ console . error ( 'Failed to fetch recipient name:' , error ) ;
50+ }
4351 } ;
4452
4553 fetchRecipientName ( ) ;
Original file line number Diff line number Diff line change @@ -78,10 +78,12 @@ const EditGiftScreen = () => {
7878 if ( recipientData ) {
7979 setRecipientName ( recipientData . name ) ;
8080 } else {
81- const fetchedRecipientName = await findRecipientById (
82- Number ( recipient ) ,
83- ) ;
84- setRecipientName ( fetchedRecipientName ) ;
81+ const fetchedRecipient = await findRecipientById ( Number ( recipient ) ) ;
82+ if ( fetchedRecipient ) {
83+ setRecipientName ( fetchedRecipient . name ) ;
84+ } else {
85+ console . error ( 'Recipient not found' ) ;
86+ }
8587 }
8688 } catch ( error ) {
8789 console . error ( 'Failed to fetch recipient name:' , error ) ;
You can’t perform that action at this time.
0 commit comments