fix: add optional chaining to program_id access in coupon mapping to prevent runtime errors

This commit is contained in:
Suherdy Yacob 2026-05-29 16:54:22 +07:00
parent 7a7556e8a9
commit 084bec9c04
2 changed files with 2 additions and 2 deletions

View File

@ -215,7 +215,7 @@ patch(PosOrder.prototype, {
}))
.concat(
this._code_activated_coupon_ids.map((coupon) => ({
program_id: coupon.program_id.id,
program_id: coupon.program_id?.id,
coupon_id: coupon.id,
}))
);

View File

@ -25,7 +25,7 @@ patch(PosStore.prototype, {
}))
.concat(
order._code_activated_coupon_ids.map((coupon) => ({
program_id: coupon.program_id.id,
program_id: coupon.program_id?.id,
coupon_id: coupon.id,
}))
);