Feat/logged in user data
This commit is contained in:
parent
41df7429d2
commit
595372bef0
15 changed files with 351 additions and 141 deletions
|
|
@ -1,9 +1,10 @@
|
|||
import { useCallback } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { getAuthToken, signIn, signOut } from '../redux';
|
||||
import { getAuthToken, getCurrentUser, signIn, signOut } from '../redux';
|
||||
|
||||
export function useAuth() {
|
||||
const dispatch = useDispatch();
|
||||
const currentUser = useSelector(getCurrentUser);
|
||||
const authToken = useSelector(getAuthToken);
|
||||
|
||||
const logIn = useCallback(
|
||||
|
|
@ -19,6 +20,7 @@ export function useAuth() {
|
|||
|
||||
return {
|
||||
authToken,
|
||||
currentUser,
|
||||
logIn,
|
||||
logOut,
|
||||
};
|
||||
|
|
|
|||
Reference in a new issue