diff --git a/src/helpers/epic.games.mapper.ts b/src/helpers/epic.games.mapper.ts index ff41bdd..1b10336 100644 --- a/src/helpers/epic.games.mapper.ts +++ b/src/helpers/epic.games.mapper.ts @@ -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, };