Fix gift card update view crashing when gift card created by app (#1462)
This commit is contained in:
parent
d750d3684e
commit
7ac6572a1a
1 changed files with 11 additions and 10 deletions
|
@ -32,7 +32,6 @@ const GiftCardUpdateInfoCardContent: React.FC = () => {
|
||||||
createdBy,
|
createdBy,
|
||||||
usedByEmail,
|
usedByEmail,
|
||||||
usedBy,
|
usedBy,
|
||||||
app,
|
|
||||||
product,
|
product,
|
||||||
events
|
events
|
||||||
} = giftCard;
|
} = giftCard;
|
||||||
|
@ -48,12 +47,22 @@ const GiftCardUpdateInfoCardContent: React.FC = () => {
|
||||||
// createdBy can be either customer or staff hence
|
// createdBy can be either customer or staff hence
|
||||||
// we check for issued event
|
// we check for issued event
|
||||||
if (cardIssuedEvent) {
|
if (cardIssuedEvent) {
|
||||||
|
const { app } = cardIssuedEvent;
|
||||||
|
|
||||||
|
if (app) {
|
||||||
|
return {
|
||||||
|
label: messages.issuedByAppLabel,
|
||||||
|
name: app?.name,
|
||||||
|
url: appUrl(app?.id)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const userName = getFullName(createdBy);
|
const userName = getFullName(createdBy);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: messages.issuedByLabel,
|
label: messages.issuedByLabel,
|
||||||
name: userName || createdByEmail,
|
name: userName || createdByEmail,
|
||||||
url: staffMemberDetailsUrl(createdBy.id)
|
url: staffMemberDetailsUrl(createdBy?.id)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,14 +73,6 @@ const GiftCardUpdateInfoCardContent: React.FC = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app) {
|
|
||||||
return {
|
|
||||||
label: messages.issuedByAppLabel,
|
|
||||||
name: app.name,
|
|
||||||
url: appUrl(app.id)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: messages.boughtByLabel,
|
label: messages.boughtByLabel,
|
||||||
name: getFullName(createdBy),
|
name: getFullName(createdBy),
|
||||||
|
|
Loading…
Reference in a new issue