-
-
Save anonymous/5337347aae20ff6f1b8838481959b16f 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
const demo = { | |
authorize() { | |
const pushError = (messages) => this.push({ | |
type: nTypes.ERROR, messages, action: nActionTypes.CLOSE | |
}); | |
this.$validator.validateAll('auth') | |
.then(success => { | |
if (!success) return pushError([{ message: obj.errors.all().join('<br>') }]); | |
const { email, password } = this; | |
this.login({ email, password }).catch(error => pushError(Object.keys(error.response.data).map(key => ({ | |
header: `${key.charAt(0).toUpperCase() + key.slice(1)}`, | |
message: error.response.data[key].join(' ') | |
})))); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment