Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to pass disableNotification property to <admin> #5377

Closed
panfiva opened this issue Oct 9, 2020 · 2 comments
Closed

Ability to pass disableNotification property to <admin> #5377

panfiva opened this issue Oct 9, 2020 · 2 comments
Assignees

Comments

@panfiva
Copy link

panfiva commented Oct 9, 2020

Is your feature request related to a problem? Please describe.
Per #5178, disableNotification notification parameter was added to useCheckAuth and useLogoutIfAccessDenied functions; however, disableNotification can only be used with custom resources that use these functions. Resources that standard resource component (e.g. <Resource name="posts" list={PostList} />) will still trigger notification

Describe the solution you'd like
I would like to be able to pass this option to the entire react application so that I can disable authentication requirement so i can suppress Not authenticated message globally in the application

Describe alternatives you've considered
None

Additional context
N/A

@fzaninotto
Copy link
Member

The problem is that #5255 wasn't a good fix for the #5178 problem. Adding an arguments to the hooks moves the problem up, as you noticed, and requires further modifications.

The right fix is to modify useCheckAuth in case of rejected Promise in authProvider.checkAuth(). useCheckAuth should check if the error contains a disableNotification property, and avoid dispatching the notification in that case. That would allow developers to hide the notification for the entire application by modifying their authProvider.

@fzaninotto
Copy link
Member

Fixed by #5382

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants