Skip to content

Commit

Permalink
Use separate variables for error and success messages
Browse files Browse the repository at this point in the history
  • Loading branch information
crcastle committed Dec 22, 2015
1 parent 798c16b commit f1c1c78
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
<div class="inner cover">
<div class="alert alert-danger alert-dismissible" v-if="showError" transition="expand" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close" v-on:click="showError = false"><span aria-hidden="true">&times;</span></button>
<strong>Error!</strong> {{message}}
<strong>Error!</strong> {{errorMessage}}
</div>
<div class="alert alert-success" v-if="showSuccess" transition="expand" role="alert">
<strong>Success!</strong> {{message}}
<strong>Success!</strong> {{successMessage}}
</div>
<div>
<!-- main view -->
Expand Down Expand Up @@ -65,7 +65,8 @@ export default {
return {
showError: false,
showSuccess: false,
message: '',
errorMessage: '',
successMessage: '',
store: store
}
},
Expand All @@ -83,18 +84,18 @@ export default {
},
'error': function(message) {
console.error(message)
this.message = message
this.errorMessage = message
this.showError = true
},
'success': function(message) {
console.info(message)
this.message = message
this.successMessage = message
this.showSuccess = true
const that = this
setTimeout(function() {
that.showSuccess = false
that.message = ''
that.successMessage = ''
},3000)
}
}
Expand Down

0 comments on commit f1c1c78

Please sign in to comment.