Feat/logged in user data

This commit is contained in:
Valentino 2022-02-10 13:34:44 +00:00
parent 41df7429d2
commit 595372bef0
15 changed files with 351 additions and 141 deletions

View file

@ -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,
};