[Vuejs]-Form vue.js on submit, how to link to external website with custom id? "error: Cannot read property 'dispatch' of undefined"

1👍

Try moving the initial store.dispatch('loadComments') into the created hook of your component.

export default {
  data: function () {
    return {}
  },
  methods:{
    submit(){
    let formData = new FormData(this.$refs.form)
this.Redirect(`https://www.myapp.eu/parks/${encodeURIComponent(booking_url)}/park_availability/`);
    console.log(this)
    console.log(this.$store.state)
    this.$store.dispatch("searchAccommodations", formData)
    }
  },
  created () {
    this.$store.dispatch('loadComments')
  }

}

Leave a comment