community-platform
community-platform copied to clipboard
refactor: convert discussion store to a service
@thisislawatts the goal of this PR is to understand how hard it is to migrate stores to services. And it was straightforward... fetch and add are working. Maybe you could use this code on https://github.com/ONEARMY/community-platform/pull/3102?
Some notes:
- need to decide what's the best approach to access the activeUser, here I passed it as an argument from the main component.
- unsure if this is the best way to invoke firestore
About <DiscussionContainer />
I think we should refactor it to contain all the discussion related CRUD methods, to avoid all this:
But I understand it would only be possible when research and howto modules are also migrated.
Thanks for sharing @mariojsnunes, would you be able to define what you mean by service
here?
Thanks for sharing @mariojsnunes, would you be able to define what you mean by
service
here?
Just a collection of methods for doing API requests (firestore in this case). Unlike a store, it doesn't keep state.