import { useRedirect } from 'ra-core' ; import { useEffect } from 'react' ; example export const useSupabaseAccessToken = ( { redirectTo = '/' , parameterName = 'access_token' , } = { } ) => { const redirect = useRedirect ( ) ; const urlSearchParams = new URLSearchParams ( window . location . search . substr ( 1 ) ) ; const access_token = urlSearchParams . get ( parameterName ) ; useEffect ( ( ) => { if ( access_token == null ) { if ( redirectTo !== false ) { redirect ( redirectTo ) ; } } } ) ; return access_token ; } ; export type UseSupabaseAccessTokenOptions = { redirectTo ? : string | false ; parameterName ? : string ; } ;