24 lines
714 B
TypeScript
24 lines
714 B
TypeScript
/*
|
|
* File: useAuth.ts
|
|
* Description: Custom hook for accessing auth state from redux
|
|
* Design & Developed by Tech4Biz Solutions
|
|
* Copyright (c) Spurrin Innovations. All rights reserved.
|
|
*/
|
|
|
|
import { useSelector } from 'react-redux';
|
|
import { selectUser, selectIsAuthenticated } from '../redux/authSelectors';
|
|
|
|
/**
|
|
* useAuth - returns the current user and authentication status from redux state
|
|
*/
|
|
export const useAuth = () => {
|
|
const user = useSelector(selectUser);
|
|
const isAuthenticated = useSelector(selectIsAuthenticated);
|
|
return { user, isAuthenticated };
|
|
};
|
|
|
|
/*
|
|
* End of File: useAuth.ts
|
|
* Design & Developed by Tech4Biz Solutions
|
|
* Copyright (c) Spurrin Innovations. All rights reserved.
|
|
*/
|