<template>
  <v-snackbar
    v-model="show"
    :color="color"
    :timeout="6000"
  >
    {{ text }}
    <v-btn
      dark
      flat
      @click="snackbar = false"
    >
      ปิด
    </v-btn>
  </v-snackbar>
</template>

<script>
export default {
  data () {
    return {
      snackbar: false
    }
  },
  computed: {
    show: {
      get () {
        return this.$store.getters.getSnackbar.show
      },
      set (value) {
        this.$store.commit('setSnackbar', {
          show: false,
          color: null,
          text: null
        })
      }
    },
    color () {
      return this.$store.getters.getSnackbar.color
    },
    text () {
      return this.$store.getters.getSnackbar.text
    }
  }
}
</script>

