Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Support multiple creatives being returned, core-native-x-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinsina committed Mar 13, 2024
1 parent 964000a commit d713f0f
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,18 @@ $ const timestamp = date ? dateToTimestamp(date) : undefined;
req,
debug,
})>
$ const mindfulCreativeId = get(resolved, "data.creative.mindfulCreativeId")
$ if (resolved.data && !mindfulCreativeId) throw new Error('Unable to parse mindful creative id from ad response.');
$ const resolvedData = get(resolved, "data");
$ const dataIsArray = Array.isArray(resolvedData);
$ if (resolvedData && dataIsArray && resolvedData.length) {
if (resolvedData.find((datapoint) => !get(datapoint, 'creative.mindfulCreativeId'))) {
throw new Error('Unable to parse mindful creative id(s) from ad response.');
}
} else if (resolvedData && !dataIsArray) {
if (!get(resolved, "data.creative.mindfulCreativeId")) {
throw new Error('Unable to parse mindful creative id from ad response.');
}
}
$ const mindfulCreativeId = get(resolved, "data.creative.mindfulCreativeId");
<${input.renderBody}
data=resolved.data
creative-id=mindfulCreativeId
Expand Down

0 comments on commit d713f0f

Please sign in to comment.