I am completely stuck on how to deal with fetching data from the vuex store in the best possible way. The way I want the application to work is as follows:
- When a component is mounted, check if the data exists in store
- If it exists, use that data
- If not, fetch data from API
The only problem with this is if the api data is updated after I have already fetched it to my local state. So, I am looking for some input on how to deal with this problem.
Summary: Save data in state, but also listen for updates on the api