I'm trying to use my state here to pass through as a search query but when pulling the state down using map state it's returning 'undefined' ... I've never had this problem before.
Here's the code:
import Vue from 'vue'
import Hero from '../components/Hero/Hero'
import PopularDest from '../components/PopularDest/PopularDest'
import { mapActions, mapState } from 'vuex'
export default Vue.extend({
template: `
<div class="page--sport">
<hero :action="getSportData" page="sport" title="Sport Events"></hero>
<div class="page--sport__bottom">
<h2>Popular Sport Events</h2>
<popular-dest></popular-dest>
</div>
</div>
`,
data () {
return {
searchQuery: {
query: [(this as any).searchInput],
genre: 'sport'
}
}
},
updated () {
console.log(this.searchInput)
},
components: {
Hero,
PopularDest
},
methods: {
getSportData (): void {
[(this as any ).getEventData(this.searchQuery)]
},
...mapActions([
'getEventData'
])
},
computed: {
...mapState([
'searchInput'
])
}
})
I'm using Vuex modules for the first time in this project which seems to be the only indicator to a problem for me.