I'm using nuxtjs and Laravel Passport. If a user goes to /someurl, but the login method pushes to '/' how do I store /someurl in the session so that I can push to the session variable when logging in? I have a session variable that is called, but it get's refreshed in the authentication middleware.
I'm clearly missing something.
Here is my code: in auth.js
middleware file
export default function ({ route, store, redirect }) {
let params = ''
if (!route.path.startsWith('/login') && !route.path.startsWith('/assets') && route.path !== '/') {
store.state.requestUrl = route.path
}
if (!store.state.authenticated) {
return redirect('/login')
}
and login
await this.$store.dispatch('login', {
username: this.loginDetails.username,
password: this.loginDetails.password
})
this.$router.push(this.$store.state.requestUrl) // this is always '/'
} catch (e) {
console.log(e)
this.failedLogin = true
}