I'm trying to fetch some data with nuxtServerInit like so:
async nuxtServerInit ({ commit }, context) {
if (context.req.headers.cookie) {
if (context.req.headers.cookie.split(';').find(c => c.trim().startsWith('token='))) {
const token = context.req.headers.cookie.split(';').find(c => c.trim().startsWith('token=')).substr(7)
await dispatch('CHECK_USER', token)
}
}
}
But I get the following error:
And ideas why that is?
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This bug report is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c522">#c522</a>)</em></sub></div>