File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
packages/ra-core/src/auth Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -62,22 +62,21 @@ const useAuthState = <ErrorType = Error>(
6262
6363 const queryResult = useQuery < boolean , any > ( {
6464 queryKey : [ 'auth' , 'checkAuth' , params ] ,
65- queryFn : ( { signal } ) => {
65+ queryFn : async ( { signal } ) => {
6666 // The authProvider is optional in react-admin
6767 if ( ! authProvider ) {
6868 return true ;
6969 }
70- return authProvider
71- . checkAuth ( { ...params , signal } )
72- . then ( ( ) => true )
73- . catch ( error => {
74- // This is necessary because react-query requires the error to be defined
75- if ( error != null ) {
76- throw error ;
77- }
78-
79- throw new Error ( ) ;
80- } ) ;
70+ try {
71+ await authProvider . checkAuth ( { ...params , signal } ) ;
72+ return true ;
73+ } catch ( error ) {
74+ // This is necessary because react-query requires the error to be defined
75+ if ( error != null ) {
76+ throw error ;
77+ }
78+ throw new Error ( ) ;
79+ }
8180 } ,
8281 retry : false ,
8382 ...options ,
You can’t perform that action at this time.
0 commit comments