You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using the unsaved-changes module and have encountered the following issue. On logout, I want to redirect the user to the login page. However, if the user has been editing a form at the time of logout, without having saved the changes, the guard pops up requiring a confirmation. The issue is that the user has already logged out (a confirmation dialog has already popped-up), so I don't want the guard to check for unsaved changes in the form. I noticed that the unsaved-changes service provides the unwatch function to ignore a dirty form, however since the logout button is located elsewhere (different component), I don't have access to the necessary form id. A solution would be to store the active form id in a service and use it to unwatch the corresponding form when needed, but that would require to store a new form id every time a form gets rendered. Is there a way to ignore all the changes manually at once (for example by emptying the formList property in the unsaved-changes service)?
The text was updated successfully, but these errors were encountered:
This is an interesting problem. Oblique don't currently provide a mean to achieve this, we'll need to think of a solution. Maybe with a isDisabled variable that makes the service simply ignore the changes. This would mean you will have to inject the ObUnsavedChangesService into the component that performs the logout and set the isDisabled to false. Then upon login, you should reset its value to true. Would such a solution be acceptable to you?
I suppose you mean the opposite. On logout set isDisabled to true, to basically disable the change detection and on login set is disabled to false. Yes, the proposed solution is simple and straight forward! Thank you!
Hello!
I have been using the unsaved-changes module and have encountered the following issue. On logout, I want to redirect the user to the login page. However, if the user has been editing a form at the time of logout, without having saved the changes, the guard pops up requiring a confirmation. The issue is that the user has already logged out (a confirmation dialog has already popped-up), so I don't want the guard to check for unsaved changes in the form. I noticed that the unsaved-changes service provides the unwatch function to ignore a dirty form, however since the logout button is located elsewhere (different component), I don't have access to the necessary form id. A solution would be to store the active form id in a service and use it to unwatch the corresponding form when needed, but that would require to store a new form id every time a form gets rendered. Is there a way to ignore all the changes manually at once (for example by emptying the formList property in the unsaved-changes service)?
The text was updated successfully, but these errors were encountered: