Skip to content

Instantly share code, notes, and snippets.

@bertoni
Created June 29, 2018 14:17
Show Gist options
  • Save bertoni/46b136a955ba78d16fe4360dfd3076dd to your computer and use it in GitHub Desktop.
Save bertoni/46b136a955ba78d16fe4360dfd3076dd to your computer and use it in GitHub Desktop.
Fraco acoplamento vue
<template>...</template>
<script>
export default {
name: 'SomeComponent',
methods: {
removeWithSuccess(someReturnedData) {
/* Some implementation for success case */
},
removeWithFail(error) {
/* Some implementation for fail case */
},
remove () {
this.$store.dispatch('removeSomething', this.id)
.then(returned => this.removeWithSuccess(returned))
.catch(error => this.removeWithFail(error))
},
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment