Home

Issue: 1855

Store is empty after redirect.

[issue link]

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.

This question is available on Nuxt.js community (#c1667)