Created
June 29, 2018 14:17
-
-
Save bertoni/46b136a955ba78d16fe4360dfd3076dd to your computer and use it in GitHub Desktop.
Fraco acoplamento vue
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
<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