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,
|
||||
usedByEmail,
|
||||
usedBy,
|
||||
app,
|
||||
product,
|
||||
events
|
||||
} = giftCard;
|
||||
|
@ -48,12 +47,22 @@ const GiftCardUpdateInfoCardContent: React.FC = () => {
|
|||
// createdBy can be either customer or staff hence
|
||||
// we check for issued event
|
||||
if (cardIssuedEvent) {
|
||||
const { app } = cardIssuedEvent;
|
||||
|
||||
if (app) {
|
||||
return {
|
||||
label: messages.issuedByAppLabel,
|
||||
name: app?.name,
|
||||
url: appUrl(app?.id)
|
||||
};
|
||||
}
|
||||
|
||||
const userName = getFullName(createdBy);
|
||||
|
||||
return {
|
||||
label: messages.issuedByLabel,
|
||||
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 {
|
||||
label: messages.boughtByLabel,
|
||||
name: getFullName(createdBy),
|
||||
|
|
Loading…
Reference in a new issue