Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit fdee33c

Browse files
committed
update: gift screens
1 parent b24659f commit fdee33c

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/app/(gifts)/detail-gift.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff 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();

src/app/(gifts)/edit-gift.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)