Static GitHub Issues

[2454] Store middleware throwing an Vuex error

prev: Nuxt is not a constructor
next: nuxt custom router middleware /dir/

Hi,

I am using a middleware so only registered users can see that page and this is the middleware: middleware/auth.js

export default function ({ store, redirect }) {
  if (!store.state.user.isAuthenticated) {
    redirect('/')
  }
}

and my store is a module so this is the file there: store/user.js export const state = () => ({ isAuthenticated: null, extraInfo: null, })

And now my auth middleware is working fine that is throwing an error on console when I enter the route. [vuex] unknow getter: vuex.esm.js:849

Can someone help me get rid of this error or is this a bug ?

Cheers

<!--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/c2130">#c2130</a>)</em></sub></div>