TheDigitalDauber
CDCloudflare Developers
•Created by TheDigitalDauber on 8/26/2024 in #general-help
How to trigger build fail
I am having an issue where a build completes successfully even when vital data is missing and makes the site unnavigable.
How do I trigger a build fail if fetch does not return a valid response?
Here is my Async Function:
async fetch() {
// Fetch the GlobalSettings object from Contentful,
// and if found bind it to a data prop
try {
const settingsPromise = this.$nacelle.client
.query({
query: ALLCONTENT,
variables: {
filter: {
handles: ['global-settings'],
type: 'globalSettings'
}
}
})
.then((res) => {
return res.data.allContent.edges[0].node
})
const menusPromise = this.$nacelle.client
.query({
query: ALLCONTENT,
variables: {
filter: {
type: 'menu',
first: 500
}
}
})
.then((res) => {
return res.data.allContent.edges.map((edge) => edge.node)
})
const [{ fields }, menus] = await Promise.all([
settingsPromise,
menusPromise
])
this.$store.commit('space/setMenus', menus)
const swatches = this.createColorCategories(fields?.colorSwatches)
this.initializeGlobalSettings(fields)
this.initializeColorCategories(swatches)
this.initCartMotivator()
} catch (e) {
console.warn(
No Global Settings entry found.
)
}
},3 replies
CDCloudflare Developers
•Created by TheDigitalDauber on 5/10/2024 in #pages-help
Shopify Extensibility App on Cloudflare
2 replies