I'm looking for some advice to best perform this requirement:
I need to call 3 or 4 separate APIs/endpoints to add a user to our system (using a form).
- The first call adds a user account and returns an id.
- The second creates a contact record from a different endpoint using the previous id
- Then there may be one or two more calls to create other business domain records based on the previous steps.
I have read through a few of the questions concerning multi - sequential requests: Multiple Sequential API calls in Angular 4
But I am wondering how to make the collection of calls perform like a transaction so if any of the steps fail (e.g. email regex in step 2) I can manage the error and also keep track of the step I'm on so I can continue from there as opposed to starting all over again.
I considered a combination of the answer I linked to and localStorage - is there a better solution?
Thanks