vue-auth: Role Login routing not working
When a user logins successfully i get the following returned data.
{"token":"TOKENKEY","roles":"2"}
My Auth Options Login Data returns both token and roles
var options = {
token: [{name: 'token', authType: 'bearer', foundIn: 'response'}],
loginData: {url: 'api/auth', method: 'POST', redirect: 'dashboard'},
fetchData: {url: 'api/acnt', method: 'GET'},
rolesVar: 'roles'
};
In My routing i have the following routes
Vue.router.map({
'/auth/login': {
component: (resolve) => { require(['./components/views/login.vue'], resolve); }
},
'dashboard': {
auth: ["1"],
name:"dashboard",
component: (resolve) => { require(['./components/views/dashboard.vue'], resolve); }
});
It Doesn’t Route to the dashboard. If I remove auth: [“1”] to auth:true. It works. I am getting the following error
TypeError: this.watch.data is undefined
[Learn More]app.js:15062:58
[vue-router] Uncaught error during transition:
here is a list of vue resources i am using
"@websanova/vue-auth": "^1.4.0-beta",
"vue": "^1.0.26",
"vue-hot-reload-api": "^2.0.6",
"vue-html-loader": "1.2.3",
"vue-loader": "8.5.4",
"vue-mdl": "^0.9.4",
"vue-resource": "^1.0.3",
"vue-router": "^0.7.13",
"vue-strap": "^1.0.11",
"vue-style-loader": "^1.0.0",
"vuex": "^1.0.0-rc.2",
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 39 (22 by maintainers)
Finally got it working
needed to change the options to this
Laravel Stuff
Auth Controller
Account Controller
Routes