So in the flux architecture, data flows as follows:
View -> Action -> Dispatcher -> Store
^ <-----------------------------|
So let's say the view is a comment box. When the user submits a comment, an addComment action is triggered, but where should that comment be sent to the server? Should it happen in the action function, before dispatching it, or should the store doing it when receiving the action from the dispatcher?
Both cases seam like a violation of the single responsibility pattern. Or should there be two CommentStores, one LocalCommentStore and a ServerCommentStore that both handle the addComment action?
In your case Action is responsible for both sending a pending action or optimistic update to the store and sending a call to the WebAPI:
This is a great question. Here is how I do it.
I create a module for my API. I import that module in actions.js, then dispatch the API responses to my store. Here is an example (uses fluxxor) of what the store with my API calls in my application may look like: