Hi All,
I was just reading a post about the ability to now serve nuxt in a static
mode. When trying this on my current project, I am having some issues when the site is fetching data.
Currently, I am using asyncData
to grab my data via Prismic, to then populate the page. This looks like this:
async asyncData({ $prismic, error }) {
try {
const about = await $prismic.api.query(
$prismic.predicates.at("document.type", "about")
);
return {
doc: about.results[0]
};
} catch (e) {
error({
statusCode: 404,
message: "Page not found"
});
}
}
When clicking to the about page in this case (from a nuxt-link
) I hit the 404 page, but refreshing the page when the URL is on the about page gives me the correct data and display.
For reference, I am using the nuxt.js sample from Prismic that has been modified with my data. I am also deploying to Netlify, if that makes a difference.
Any ideas?
Thank you much!