feat: manage press fallback labels via payload
This commit is contained in:
@@ -32,8 +32,14 @@ async function main() {
|
||||
const page = pageResult.docs[0]
|
||||
if (!page) throw new Error('Press index page not found. Expected spaPath=/presse or slug=presse/press.')
|
||||
|
||||
const heroImage = await mediaByFilename(payload, pressIndexContent.hero.imageFilename)
|
||||
const [heroImage, eventFallbackImage, newsFallbackImage] = await Promise.all([
|
||||
mediaByFilename(payload, pressIndexContent.hero.imageFilename),
|
||||
mediaByFilename(payload, pressIndexContent.events.collectionFallbackImageFilename),
|
||||
mediaByFilename(payload, pressIndexContent.news.collectionFallbackImageFilename),
|
||||
])
|
||||
const { imageFilename: _heroFilename, ...heroContent } = pressIndexContent.hero
|
||||
const { collectionFallbackImageFilename: _eventFallbackFilename, ...eventsContent } = pressIndexContent.events
|
||||
const { collectionFallbackImageFilename: _newsFallbackFilename, ...newsContent } = pressIndexContent.news
|
||||
|
||||
await payload.update({
|
||||
collection: 'pages',
|
||||
@@ -47,6 +53,14 @@ async function main() {
|
||||
...heroContent,
|
||||
image: heroImage,
|
||||
},
|
||||
events: {
|
||||
...eventsContent,
|
||||
collectionFallbackImage: eventFallbackImage,
|
||||
},
|
||||
news: {
|
||||
...newsContent,
|
||||
collectionFallbackImage: newsFallbackImage,
|
||||
},
|
||||
},
|
||||
} as never,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user