UNPKG

ra-core

Version:

Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React

32 lines 1.16 kB
/** * Get a callback for calling the authProvider.logout() method, * redirect to the login page, and clear the store. * * @see useAuthProvider * * @returns {Function} logout callback * * @example * * import { useLogout } from 'react-admin'; * * const LogoutButton = () => { * const logout = useLogout(); * const handleClick = () => logout(); * return <button onClick={handleClick}>Logout</button>; * } */ declare const useLogout: () => Logout; /** * Log the current user out by calling the authProvider.logout() method, * and redirect them to the login screen. * * @param {Object} params The parameters to pass to the authProvider * @param {string} redirectTo The path name to redirect the user to (optional, defaults to login) * @param {boolean} redirectToCurrentLocationAfterLogin Whether the button shall record the current location to redirect to it after login. true by default. * * @return {Promise} The authProvider response */ type Logout = (params?: any, redirectTo?: string | false, redirectToCurrentLocationAfterLogin?: boolean) => Promise<any>; export default useLogout; //# sourceMappingURL=useLogout.d.ts.map