Created
February 3, 2018 14:10
-
-
Save anselmobattisti/ffbea6ee1be85859144850db57c5dd3b to your computer and use it in GitHub Desktop.
To access this inside a nested function create a local variable and store this in this valiable, like the example above
This file contains hidden or 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
methods: { | |
save (evt) { | |
let self = this | |
evt.preventDefault() | |
this.$validator.validateAll().then((result) => { | |
if (result) { | |
EventBus.$emit('startLoading') | |
dbUser.save(this.user) | |
.then((resp) => { | |
EventBus.$emit('stoptLoading') | |
if (!resp.erro) { | |
swal({ | |
title: i18n.tc('general.successsave'), | |
type: 'success' | |
}) | |
} else { | |
} | |
}) | |
.catch((e) => { | |
EventBus.$emit('stoptLoading') | |
if (e.data.error.code === 11000) { | |
swal({ | |
title: i18n.tc('user.duplicatedEmail'), | |
type: 'error' | |
}).then(() => { | |
self.$refs.email.focus() | |
}) | |
} else { | |
swal({ | |
title: e.data.message, | |
type: 'error' | |
}) | |
} | |
}) | |
} | |
}) | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment