From 5a0e3e58f9d17ce087c16ab5c1f8faec1b3dd603 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Thu, 9 Jun 2022 19:09:56 -0500 Subject: [PATCH] Add relatedVideos getter --- helpers/listing-page.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/helpers/listing-page.js b/helpers/listing-page.js index 982f1a1..c04f6ff 100644 --- a/helpers/listing-page.js +++ b/helpers/listing-page.js @@ -128,8 +128,20 @@ export class ListingDetails { return makeApiPathFromEndpoint( this.api.endpoint ) } + get relatedVideos () { + if ( Array.isArray( this.api.relatedVideos ) ) { + return this.api.relatedVideos + } + + if ( !!this.api.payload && Array.isArray( this.api.payload.relatedVideos ) ) { + return this.api.payload.relatedVideos + } + + return [] + } + get hasRelatedVideos () { - return Array.isArray( this.api.relatedVideos ) && this.api.relatedVideos.length > 0 + return this.relatedVideos.length > 0 } get hasRelatedApps () {