From 7b2d632dcdca7141d907fb85143cefdf43fdf3df Mon Sep 17 00:00:00 2001 From: Anthony Pillot Date: Mon, 26 Dec 2022 16:04:24 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Pick=20`productSlug`=20or=20`cat?= =?UTF-8?q?alogNs.mappings.pageSlug`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/helpers/epic.games.mapper.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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, };