check: function(context) {
return context.$http.get('/api/v1/user').then((response) => {
if (response.body.user != null) {
this.user.authenticated = true
}
}, (response) =>{
сonsole.log(response)
});
}
beforeRouteEnter (to, from, next) {
Auth.check().then( ( ) => {
if(!Auth.user.authenticated)
next({ path: '/login' })
else
next()
})
}