Skip to content

Commit

Permalink
Reject promise in checkError with logoutUser: false and without redir…
Browse files Browse the repository at this point in the history
…ectTo causes an error marmelab#10172
  • Loading branch information
rktamil committed Sep 1, 2024
1 parent 733e7a6 commit 05dc2a6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/ra-core/src/auth/useLogoutIfAccessDenied.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 05dc2a6

Please sign in to comment.