I actually using Axios in a Nuxt.js project to catch Json file to display it on my website. I would like to use a variable store in Vuex to select the path for my Axios get request.
Here's what my <script> looks like:
<script>
import axios from 'axios'
import vuex from 'vuex'
export default {
async asyncData({ }) {
const json = await axios.get(`https://myurl.com/${$store.getters["getPath"]}`)
return { json }
}
}
</script>
Pretty sure that isn't the good method to do it. I receive the console error : ReferenceError: store is not defined.
Thanks in advance!