import { CART_COUNT } from '@/store/utils/localStorageKeys'
import { mapGetters } from 'vuex'

export default {
  computed: {
    ...mapGetters('eshop', ['getCartTotal']),
  },
  watch: {
    getCartTotal: {
      handler(to) {
        localStorage.setItem(CART_COUNT, to)
        this.$nextTick(() => {
          let cartCount = document.getElementById('cartCount')
          if (cartCount) {
            cartCount.innerHTML = to
          }
        })
      },
      immediate: true,
    },
  },
}
