Use related videos helper on app pages

This commit is contained in:
Sam Carlton 2020-12-26 19:18:42 -06:00
parent 899bac2106
commit afec75f482

View file

@ -76,17 +76,18 @@ export default {
async asyncData ({ params: { slug } }) { async asyncData ({ params: { slug } }) {
const { default: videoList } = await import('~/static/video-list.json') const { default: videoList } = await import('~/static/video-list.json')
const { videosRelatedToApp } = await import('~/helpers/related.js')
const app = appList.find(app => (app.slug === slug)) const app = appList.find(app => (app.slug === slug))
const relatedVideos = [] const relatedVideos = videosRelatedToApp(app)
// Find other videos that also feature this video's app // Find other videos that also feature this video's app
for (const video of videoList) { // for (const video of videoList) {
if (!video.apps.includes(app.slug)) continue // if (!video.apps.includes(app.slug)) continue
relatedVideos.push(video) // relatedVideos.push(video)
} // }
return { return {
slug, slug,