methods: {
login() {
var redirect = this.$auth.redirect() // ВОТ ЭТО МОЗОЛИТ ГЛАЗА ОЧЕНЬ СИЛЬНО
var app = this // И ВОТ ЭТО
this.$auth.login({
params: {
email: app.email,
password: app.password
},
success: function () {
// handle redirection
const redirectTo = redirect ? redirect.from.name : this.$auth.user().role === 2 ? 'admin.dashboard' : 'dashboard'
this.$router.push({name: redirectTo})
},
error: function (error) {
app.has_error = true
app.errors = error.response.data.errors || {}
app.error = error.response.data.error
},
rememberMe: app.remember_me,
fetchUser: true
})
},
........
}
methods: {
login() {
this.$auth.login({
params: {
email: this.email,
password: this.password
},
success: () => {
// handle redirection
const redirectTo = this.$auth.redirect()
? this.$auth.redirect().from.name
: this.$auth.user().role === 2
? 'admin.dashboard'
: 'dashboard'
this.$router.push({name: redirectTo})
},
error: error => {
this.has_error = true
this.errors = error.response.data.errors || {}
this.error = error.response.data.error
},
rememberMe: this.remember_me,
fetchUser: true
})
},
........
}