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

Fix loading indicator not updated on permissions error when logoutUser is false #7044

Merged
merged 3 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/ra-core/src/auth/useLogoutIfAccessDenied.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const useLogoutIfAccessDenied = (): LogoutIfAccessDenied => {
const logout = useLogout();
const notify = useNotify();
const history = useHistory();

const logoutIfAccessDenied = useCallback(
(error?: any, disableNotification?: boolean) =>
authProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ export const performOptimisticQuery = ({
console.error(error);
}
return logoutIfAccessDenied(error).then(loggedOut => {
if (loggedOut) return;
if (loggedOut) {
dispatch({ type: FETCH_END });
return;
}
dispatch({
type: `${action}_FAILURE`,
error: error.message ? error.message : error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ export const performPessimisticQuery = ({
console.error(error);
}
return logoutIfAccessDenied(error).then(loggedOut => {
if (loggedOut) return;
if (loggedOut) {
dispatch({ type: FETCH_END });
return;
}
dispatch({
type: `${action}_FAILURE`,
error: error.message ? error.message : error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ export const performUndoableQuery = ({
console.error(error);
}
return logoutIfAccessDenied(error).then(loggedOut => {
if (loggedOut) return;
if (loggedOut) {
dispatch({ type: FETCH_END });
return;
}
dispatch({
type: `${action}_FAILURE`,
error: error.message ? error.message : error,
Expand Down