I am designing redux actions for a user signup. Signup process requires three entities to be created User, UserProfile and an Offer and involves side effects to handle async server calls.
I wonder what actions should be introduced to make them clear, readable and not overcomplicated. The minimum set of actions I can think of could be
User.SIGNUP_START- triggered by form submit
- consumed by
UserEffects.signUp
User.SESSION_TOKEN- dispatched by
UserEffects.signUpto indicate session returned by the server - consumed by
UserReducersto update redux state
- dispatched by
User.SIGNUP_SUCCESS- dispatched by
UserEffects.signUp, contains just a reference to the created entity - consumed by
UserReducersto update redux state - consumed by
UserEffects.createProfile- here is the first doubt if dedicatedUserProfile.CREATEaction should be used and how?
- dispatched by
UserProfile.CREATE_SUCCESS- dispatched by
UserEffects.createProfile, contains just a reference to the created entity - consumed by
UserReducersto update redux state - consumed by
UserEffects.createOffer- same doubt if dedicatedOffer.CREATEaction should be used and how?
- dispatched by
Offer.CREATE_SUCCESS- dispatched by
UserEffects.createOffer, contains just a reference to the created entity - consumed by
UserReducersto update redux state
- dispatched by
To make the above list simple I've skipped *.*_ERROR actions I have in my code.
Main question is - should there be CREATE, CREATE_SUCCESS, CREATE_ERROR set of actions for each async server call or is it ok for Effects to listen just to *.CREATE_SUCCESS to initiate async call to create next entity in the flow?
I'd like to avoid too much boilerplate related to action creators yet I prefer readable design.
NOTES
- chained async calls are there as I would like to avoid backend code for the time being (the plan is to move directly to GraphQL in the future).
- as for the terminology I'm using Angular &
ngrx/storeyet the problem is relevant to any Redux solution.