Static GitHub Issues

[1855] Store is empty after redirect.

prev: inject('i18n', new VueI18n(...)) doesn't work in plugin files
next: Nuxt.js does not respect layouts in separate folders.

Hi,

Im using middleware that checks auth. If its empty i will redirect user to login page with a message.

export default function ({ store, redirect }) {
  if (!store.state.authUser) {
    store.commit('SET_NOTI', {
      type: 'warn',
      title: 'Login',
      message: 'You need to log in'
    })
    console.log(store.state.notiAfterRoute)
    redirect('/login')
  }
}

But after redirect by store is null ( the value it should be on start) . If i console log it before redirect. it returns a object like it should.

I have tryed to solve this for couple of hours now. I tryed to use dispatch, promises everything.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1667">#c1667</a>)</em></sub></div>