mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Manually read payload if undefined
This commit is contained in:
parent
99ca5a5ff8
commit
c894f3726c
1 changed files with 24 additions and 19 deletions
|
|
@ -107,33 +107,38 @@ export default {
|
|||
VideoPlayer,
|
||||
ChannelCredit
|
||||
},
|
||||
asyncData ({ params: { slug }, payload: { app, allVideos, submitVideoCard } }) {
|
||||
async asyncData ( data ) {
|
||||
|
||||
// const { allVideoAppsList } = await import('~/helpers/get-list.js')
|
||||
// // const { default: videoList } = await import('~/static/video-list.json')
|
||||
const {
|
||||
params: { slug },
|
||||
route
|
||||
} = data
|
||||
|
||||
// const { videosRelatedToApp } = await import('~/helpers/related.js')
|
||||
let {
|
||||
payload
|
||||
} = data
|
||||
|
||||
// const app = allVideoAppsList.find(app => (app.slug === slug))
|
||||
|
||||
// const submitVideoCard = {
|
||||
// endpoint: `https://docs.google.com/forms/d/e/1FAIpQLSeEVGM9vE7VcfLMy6fJkfU70X2VZ60rHDyhDQLtnAN4nso0WA/viewform?usp=pp_url&entry.1018125313=${app.name}`
|
||||
// }
|
||||
|
||||
// // const featuredApps = []
|
||||
// Manually get payload as fallback
|
||||
if ( payload === undefined ) {
|
||||
const { promises: fs } = await import('fs')
|
||||
|
||||
// const relatedVideos = videosRelatedToApp( app ).map(video => {
|
||||
// // console.log('video', video)
|
||||
// return {
|
||||
// ...video,
|
||||
// // endpoint: `#${video.id}`
|
||||
// }
|
||||
// })
|
||||
// Read back the JSON we just wrote to ensure it exists
|
||||
const savedListJSON = await fs.readFile('./static/nuxt-endpoints.json', 'utf-8')
|
||||
const savedList = JSON.parse( savedListJSON )
|
||||
|
||||
const endpoint = savedList.find( resource => {
|
||||
return resource.route === route.path
|
||||
} )
|
||||
|
||||
payload = endpoint.payload
|
||||
}
|
||||
|
||||
return {
|
||||
app,
|
||||
allVideos,
|
||||
submitVideoCard
|
||||
app: payload.app,
|
||||
allVideos: payload.allVideos,
|
||||
submitVideoCard: payload.submitVideoCard
|
||||
}
|
||||
},
|
||||
data: function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue