#5 Moving away from vuex
Now that I'm using the composition API, I feel Vuex
is no longer necessary, the same can be achieved extracting logic to different modules. Actually, I'm trying to reproduce a similar structure I use in my NestJS projects.
It works, sort of, although IoC
is missing in this architecture, and I'm coupling components that should be separated:
- Visual components: I have my visual components that only care about visual stuff, and might have some small
state
(to take care of the active tab or such visual stuff). This layer takes functionality from the next layer (as described in the guides about composition API). - Shared setups I have created a new entity that I called
<module>.setup.ts
, which contains theuse
function (similar touseStore()
). This returns some mmethods, getters and sometimes even some state. This layer uses yet another layer that handles data. - Data layer: There is another abstraction layer that is used to take care of data (
SurveyRepository
andConfigRepository
). These two interfaces have implementations that useslocalStorage
(Ionic'sStorage
actually, but it's pretty muchlocalStorage
).
But this approach has 2 problems that I can see so far:
First problem
There is no way to use whatever I need from the 2nd layer in any other layer. It's only usable within visual components. This very same problem happens with useStore()
: I noticed I wasn't able to get values from the store in hook from vue-router
. This is a small project, but it wouldn't be crazy that a certain functionality in an entity of the 2nd layer needed some other stuff from another entity that's also in the 2nd layer.
Conclusion
I think I need another layer, that 2nd layer looks more like a Controller, and I'm missing the Service layer.
Second problem
I have this kind of code:
Is this bad? well, a bit. I shouldn't be creating the exact type of repository by myself in the place I'm using it! SOLID gods might be crying now.
Conclusion
I need some DI solution. I've tested typedi
in the past (for the backend) and it did the trick, it's probably working here too :)
#4 Statistics
I've improved the statistics shown for the surveys
#3 Lock, for real!
It's important to lock the Play view, so users giving feedback can't go out that view.
#2 Basic flow and functionality
This is the second day I work on this project. Basic flow is in place now
#1 Designing the app, scope, architecture
This is just the first day, not very amusing (designing, scoping etc.)