Does someone know how display a snackbar depending of the result of answer of server.
For example, if submit is ok, display success green snack bar with success message but if I have a error I need to display a red error snack bar with a binding of the error message.
I think I need to pass through a method to display it. I want do this in just one snackbar like this.
<v-snackbar
:color = "color"
> {{text here}}
</v-snackbar
example of server post
http.post(apiAdresse, objectToPost)
.then(() => {
something to do here})
.catch(error => {
console.log(error)};)
edit code:
<v-snackbar
:color="snackbar.color"
v-model="snackbar.show">
<v-icon class="snackIcon">{{snackbar.icon}}</v-icon>
{{ snackbar.message }}
<v-btn
dark
text
@click="snackbar = false"
>
Close
</v-btn>
</v-snackbar>
When I'm clicking on close btn
Error in v-on handler: "TypeError: Cannot use 'in' operator to search for 'show' in false"