File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
packages/ra-core/src/auth Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ const useLogoutIfAccessDenied = (): LogoutIfAccessDenied => {
4343 const logout = useLogout ( ) ;
4444 const notify = useNotify ( ) ;
4545 const navigate = useNavigate ( ) ;
46+
47+ const handleRedirect = ( url : string ) => {
48+ if ( url . startsWith ( 'http' ) ) {
49+ window . location . href = url ;
50+ } else {
51+ navigate ( url ) ;
52+ }
53+ } ;
54+
4655 const logoutIfAccessDenied = useCallback (
4756 ( error ?: any ) => {
4857 if ( ! authProvider ) {
@@ -102,16 +111,9 @@ const useLogoutIfAccessDenied = (): LogoutIfAccessDenied => {
102111
103112 if ( logoutUser ) {
104113 logout ( { } , redirectTo ) ;
105- } else {
106- if ( redirectTo . startsWith ( 'http' ) ) {
107- // absolute link (e.g. https://my.oidc.server/login)
108- window . location . href = redirectTo ;
109- } else {
110- // internal location
111- navigate ( redirectTo ) ;
112- }
114+ } else if ( redirectTo ) {
115+ handleRedirect ( ) ;
113116 }
114-
115117 return true ;
116118 } ) ;
117119 } ,
You can’t perform that action at this time.
0 commit comments