Nuxt.js mounted hook not firing when page redirect

Viewed 27

I am implementing facebook view content event with Nuxt.js and have issue with mounted hook. So the issue is when first page loading, mounted logged but whenever back to opened page, it isn't firing mounted hook. This is my code.

import { mapGetters, mapMutations, mapActions } from 'vuex'
export default {
  ...
  async mounted(){
    console.log('mounted')
    console.log(this.namespace)
    console.log(this.$store.state)
    if (this.$store.state[this.namespace]) {
      this.productView({ product, selectedVariant })
    }
  },
  methods: {
    ...mapActions('events', ['productView'])
  }
}

console log

As I said above, when I first load the page, I can see the log but whenever I return page, it isn't logging and page view event is also not firing.

I am using Vercel and Nuxt for Shopify headless.

0 Answers
Related