Browse Source

fix(claims): handle single Offer object in fulfills field

Updated extractOfferFulfillment to support both array and single object
cases for the fulfills field. Previously only handled array format,
now also checks if fulfills is a single Offer object with @type "Offer".
pull/167/head
Jose Olarte III 2 weeks ago
parent
commit
d87f44b75d
  1. 15
      src/views/ClaimView.vue

15
src/views/ClaimView.vue

@ -739,13 +739,18 @@ export default class ClaimView extends Vue {
} }
const fulfills = this.detailsForGive.fullClaim.fulfills; const fulfills = this.detailsForGive.fullClaim.fulfills;
if (!Array.isArray(fulfills)) {
this.detailsForGiveOfferFulfillment = null; // Handle both array and single object cases
return; let offerFulfill = null;
if (Array.isArray(fulfills)) {
// Find the Offer in the fulfills array
offerFulfill = fulfills.find((item) => item["@type"] === "Offer");
} else if (fulfills["@type"] === "Offer") {
// fulfills is a single Offer object
offerFulfill = fulfills;
} }
// Find the Offer in the fulfills array
const offerFulfill = fulfills.find((item) => item["@type"] === "Offer");
if (offerFulfill) { if (offerFulfill) {
this.detailsForGiveOfferFulfillment = { this.detailsForGiveOfferFulfillment = {
offerHandleId: offerFulfill.identifier, offerHandleId: offerFulfill.identifier,

Loading…
Cancel
Save