I have an observable called submit$
that submits a form. If this observable encounters an error with status code 403
, it means the user is not authorized and needs to log in first.
Is there a way to automatically trigger another observable when a specific error code occurs? This new observable would handle the authorization process. Once the authorization is successful, I want the submit$
observable to be repeated without requiring the user to manually invoke it again.
Here are the steps I envision:
- The user attempts to submit the form and the
submit$
observable is activated - An error with status code
403
is encountered - The observable then calls a separate
authorise$
observable which handles the authorization workflow - Upon successful authorization, the
submit$
observable is triggered again - The process concludes with either success or error
- If an error arises during the authorization process, the
submit$
operation is terminated