From f33335c76cf3b2f8d607486c01b90f7a3a6a2ce8 Mon Sep 17 00:00:00 2001 From: Reed Vogt Date: Fri, 24 Nov 2023 21:47:55 -0800 Subject: [PATCH] add --- src/App.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/App.js b/src/App.js index 9d43fee..0150961 100644 --- a/src/App.js +++ b/src/App.js @@ -29,14 +29,18 @@ import { useCookies } from 'react-cookie'; import { useDeckStore } from './context/DeckContext/DeckContext'; import { useCartStore } from './context/CartContext/CartContext'; const App = () => { - const [cookies] = useCookies(['user']); + // const [cookies] = useCookies(['user']); - const user = cookies?.user; - const userId = user?.id; + // const user = cookies?.user; + // const userId = user?.id; const [currentPage, setCurrentPage] = useState(''); // const { setContext } = useAppContext(); // Assuming useAppContext provides setContext const { fetchAllCollectionsForUser, selectedCollection } = useCollectionStore(); + const { user, fetchUser } = useUserContext(); + const userId = user?.id; + console.log('user', user); + console.log('userId', userId); const { allDecks, fetchAllDecksForUser, selectedDeck } = useDeckStore(); const { fetchUserCart, cartData } = useCartStore(); const { isLoading, setIsLoading } = useUtilityContext(); @@ -48,7 +52,7 @@ const App = () => { // }, []); // Add this useEffect useEffect(() => { - if (user) { + if (userId) { fetchAllCollectionsForUser() .then(() => { setIsLoading(false);