I'm trying to redirect users that go to '/' to a specific component based on its name.
{
path: '/',
redirect: to => {
if (!localStorage.getItem('quizlogin')) {
return {
name: 'login'
}
} else {
return {
name: 'creatingquiz'
}
}
}
},
When the named route creatingquiz is loaded it provides path: userUrlName + '/creatingquiz',
but for some reason on redirect it doesn't understand that.
I get the warning "[vue-router] missing param for named route "creatingquiz": Expected "userName" to be defined"
What am I missing? I've had no issues routing using {name:<route-name>, params:{username:<blah>}}
params
object withuserName
attribute inside. - IVO GELOVreturn { name: 'creatingquiz': params: { userName: 'foo' } }
. - User 28