-
-
Save Fl0pZz/001180ee41a73de33102388f73eef2a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
authorize () { | |
let obj = this | |
this.$validator.validateAll('auth') | |
.then(success => { | |
if (success) { | |
console.log(obj) | |
// obj.login({ | |
// email: obj.email, | |
// password: obj.password | |
// }) | |
obj.login({ email, password } = obj) | |
.catch(error => { | |
obj.push({ | |
type: nTypes.ERROR, | |
messages: Object.keys(error.response.data) | |
.map(key => { | |
return { | |
header: `${key.charAt(0).toUpperCase() + key.slice(1)}`, | |
message: error.response.data[key].join(' ') | |
} | |
}), | |
action: nActionTypes.CLOSE | |
}) | |
}) | |
} else { | |
obj.push({ | |
type: nTypes.ERROR, | |
messages: [{ message: obj.errors.all().join('<br>') }], | |
action: nActionTypes.CLOSE | |
}) | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment