-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Reject promise in checkError with logoutUser: false and without redirectTo causes an error #10172 #10177
base: master
Are you sure you want to change the base?
Reject promise in checkError with logoutUser: false and without redirectTo causes an error #10172 #10177
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,12 +103,17 @@ const useLogoutIfAccessDenied = (): LogoutIfAccessDenied => { | |
if (logoutUser) { | ||
logout({}, redirectTo); | ||
} else { | ||
if (redirectTo.startsWith('http')) { | ||
// absolute link (e.g. https://my.oidc.server/login) | ||
window.location.href = redirectTo; | ||
if (redirectTo != null) { | ||
if (redirectTo.startsWith('http')) { | ||
// absolute link (e.g. https://my.oidc.server/login) | ||
window.location.href = redirectTo; | ||
} else { | ||
// internal location | ||
navigate(redirectTo); | ||
} | ||
} else { | ||
// internal location | ||
navigate(redirectTo); | ||
// If there is not redirect return false saying loguout is not successful | ||
return false; | ||
Comment on lines
103
to
+116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better instead of using this nested if else condition we can make functions and use. This will help others to understand more easily and help to maintain the clean code e.g:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the long delay. Indeed, you could do that too |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should rather return
true
here, since logout was explicitly not requested, and I'm afraid this will throw another error in this code:react-admin/packages/ra-core/src/dataProvider/useDataProvider.ts
Lines 124 to 136 in f67649d