/** * Get a callback for calling the authProvider.checkAuth() method. * In case of rejection, redirects to the login page, displays a notification, * and throws an error. * * This is a low level hook. See those more specialized hooks * for common authentication tasks, based on useCheckAuth. * * @see useAuthenticated * @see useAuthState * * @returns {Function} checkAuth callback * * @example * * import { useCheckAuth } from 'react-admin'; * * const MyProtectedPage = () => { * const checkAuth = useCheckAuth(); * useEffect(() => { * checkAuth().catch(() => {}); * }, []); * return
Private content: EZAEZEZAET
* } // tip: use useAuthenticated() hook instead * * const MyPage = () => { * const checkAuth = useCheckAuth(); * const [authenticated, setAuthenticated] = useState(true); // optimistic auth * useEffect(() => { * checkAuth({}, false) * .then(() => setAuthenticated(true)) * .catch(() => setAuthenticated(false)); * }, []); * return authenticated ?