diff --git a/src/app/profileScreen/page.tsx b/src/app/profileScreen/page.tsx index a2f5497..ae34f0c 100644 --- a/src/app/profileScreen/page.tsx +++ b/src/app/profileScreen/page.tsx @@ -371,20 +371,20 @@ export default function Profile() { const data = await fetchUser(); setUser(data); } + async function fetchProducts() { + const data = (await arrayOfFavorites()) as Product[]; + const mapCategories = await Promise.all( + data.map(async product => { + const updateCategory = await convertButtonNumberToCategory( + product.category, + ); + return { ...product, category: updateCategory }; + }), + ); + setFavorites(mapCategories); + } useEffect(() => { - async function fetchProducts() { - const data = (await arrayOfFavorites()) as Product[]; - const mapCategories = await Promise.all( - data.map(async product => { - const updateCategory = await convertButtonNumberToCategory( - product.category, - ); - return { ...product, category: updateCategory }; - }), - ); - setFavorites(mapCategories); - } fetchProducts(); fetchOrders(); getUser();