I am seeking guidance on how to efficiently execute the following task:
To add a user to our system through a form, I need to make 3 or 4 separate API calls/endpoints.
- The first call will create a user account and return an ID.
- The second call will generate a contact record using the previous ID from a different endpoint.
- Subsequent calls may be needed to create additional business domain records based on the previous steps.
I have reviewed some discussions on executing multiple sequential requests: Multiple Sequential API calls in Angular 4
However, I am unsure of how to ensure that all the calls function as a single transaction. In case any step fails (such as invalid email regex in step 2), I want to handle the error and resume from where it stopped rather than restarting the entire process.
One idea I had was combining the solution provided in the reference with localStorage - but is there a more effective approach?
Thank you