mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
docs: update documentation for custom auth hooks
This commit is contained in:
@@ -3,14 +3,10 @@ import { useRouter } from 'next/router';
|
||||
import { useContext } from 'react';
|
||||
|
||||
/**
|
||||
* Custom React hook that redirects the user to the home page if they are logged in.
|
||||
* A custom hook to redirect the user to the home page if they are logged in.
|
||||
*
|
||||
* This hook is used to prevent logged in users from accessing the login and signup pages
|
||||
* by redirecting them to the home page.
|
||||
*
|
||||
* This hook should only be used in a component that is under the UserContext provider.
|
||||
*
|
||||
* @returns {void}
|
||||
* and should only be used in a component that is under the UserContext provider.
|
||||
*/
|
||||
const useRedirectWhenLoggedIn = (): void => {
|
||||
const { user } = useContext(UserContext);
|
||||
|
||||
Reference in New Issue
Block a user