0👍
Is your app used by many users at the same time? How will you handle new lessons added by other users?
I think you misunderstood the main concept of vuex, which is to have a centralized store to keep the state through the whole app.
IMO, there are 2 ways to face this:
-
Fetch your data from DB all the time with no need for vuex. I don’t see any complexity to avoid fetching data from DB as many times as you need. In this way, if any other user adds/deletes/updates a lesson/activity/unit you will be sure that you are seeing everything up-to-date.
-
Using vuex + Websockets. Implementing vuex + WebSockets gives a really nice user experience. You can fetch all data when the app mounts, and then listen for WebSocket events so you can hydrate your vuex state. This way is a little more complex since you have to maintain a WebSocket server.
In addition, keeping your data within your localStorage seems insecure to me. You could manipulate what is stored and send whatever you want to your API.
Saying that I would ask myself:
- Do I need to keep my data through the whole app?
- Can any other user add/update/delete anything that I need to know?
- Are queries really complex to impact my app performance?
- [Vuejs]-How can I make the form editable when I click the edit button?
- [Vuejs]-VueJS Multiple conditions for style