Hi! First of all, a big thank you for investing so much time and effort in this project. We have recently begun adapting our Vue website to Nuxt and we are extremely positive so far.
Unfortunately though, today we came across a problem we don't really see how to fix at this point. A somewhat redacted version can be found here: https://glitch.com/edit/#!/wandering-market
We have cards
which are offered depending on the user's location. Either the user chooses a location himself or we select the default coordinates store/index.js 13:15
. These coordinates need to be passed on to the API using the request's headers. We have an API class that communicates with the server, which also initiates the axios
instance.
This is where we are starting to hesitate whether we are approaching this correctly. The API's function setLocation
is called in the store/index.js
because this is where we fill the store with cards from the user's session. If the session is empty, we ask the API to fetch new ones.
The first time the page loads, everything is working as expected. The problem is though, when we call the API again to reload the deals, it completely forgets about the earlier called API.setLocation()
, probably because the API.js
gets imported again. Surely, this is an architectural problem with our system, but we can't seem to figure out how to approach this in a better way. Any help is much appreciated!