I placed a middleware on a page like:
export default{
middleware:['isAuth']
}
and this is the middleware code
export default function ({store, redirect}) {
console.log(process.client) => never called on page-reload
if (!store.getters.canEdit && process.client) {
return redirect('/')
}
}
This middleware works if I route to pages which are connected to the middleware. But if I do a page-reload on a page then the code is only getting executed on the server. Is this a bug or by design?
The middleware should execute always client and server side - either on page reload or routing.
<!--cmty--><div align="right"><sub><em>This feature request is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c6873">#c6873</a>)</em></sub></div>