Hi!
I have a little problem with this solution:
async asyncData({ $prismic, params, store }) {
const page = await $prismic.api.getByUID("article", params.uid);
const { results: articles } = await $prismic.api.query($prismic.predicate.at("document.type", "article"));
const prevpost = (await $prismic.api.query(
$prismic.predicates.at("document.type", "article"),
{
pageSize : 1 ,
after : `${article.id}`,
orderings: '[my.article.date]'
}
)).results[0]
const nextpost = (await $prismic.api.query(
$prismic.predicates.at("document.type", "article"),
{
pageSize : 1 ,
after : `${article.id}`,
orderings: '[my.article.date desc]'
}
)).results[0]
return {
page,
articles,
prevpost,
nextpost
};
},
And HTML:
<nuxt-link v-if="prevpost" :to="prevpost.url" class="button">Previous Post</nuxt-link>
<nuxt-link to="/blog" class="button">All posts</nuxt-link>
<nuxt-link v-if="nextpost" :to="nextpost.url" class="button">Next Post</nuxt-link>
I have an error : "article is not defined".
I don't understand what i'm doing wrong.