I am trying to implement a page that will periodically check prismic for new content and render it 'live' on the page.
async fetch() {
console.log("checking");
try {
let prismicResponse = await this.$prismic.api.query(
this.$prismic.predicates.at('document.type', 'live_post'),
{lang: 'en-gb'}
)
const content = prismicResponse.results
const posts = content.map(c => {
return {
id: c.id,
type: c.data.post_type,
html: this.$prismic.asHtml(c.data.main_content)
}
})
this.posts = posts
setTimeout(this.$fetch, 2000)
} catch (e) {
console.log(e)
}
},
But when I add new content in Prismic the api response is still the same, and doesn't include the new content. If I refresh the page the new content appears as expected. Having read the FAQs, it seems to be issue 2, but I'm not sure how to go about rebuilding/refreshing the api object.