Skip to content

Commit

Permalink
🐛 Pick productSlug or catalogNs.mappings.pageSlug
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonypillot committed Dec 26, 2022
1 parent 03e333d commit 7b2d632
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/helpers/epic.games.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ export class EpicGamesMapper {
const newElement: GameInterface = {
title: game.title,
description: game.description,
urlSlug: `https://store.epicgames.com/fr/p/${game.catalogNs.mappings[0]?.pageSlug}`,
urlSlug: `https://store.epicgames.com/fr/p/${
game.productSlug || game.catalogNs.mappings[0]?.pageSlug
}`,
promotion: {
startDate: game.free
startDate: game.free
? game.promotions.promotionalOffers[0].promotionalOffers[0].startDate.toString()
: game.promotions?.upcomingPromotionalOffers[0]?.promotionalOffers[0].startDate.toString(),
endDate: game.free
endDate: game.free
? game.promotions.promotionalOffers[0].promotionalOffers[0].endDate.toString()
: game.promotions?.upcomingPromotionalOffers[0]?.promotionalOffers[0].endDate.toString()
: game.promotions?.upcomingPromotionalOffers[0]?.promotionalOffers[0].endDate.toString(),
},
imageUrl: game.keyImages[1].url,
};
Expand Down

0 comments on commit 7b2d632

Please sign in to comment.