diff --git a/frontend/src/pages/Account.jsx b/frontend/src/pages/Account.jsx index 8fe243a..aad1545 100644 --- a/frontend/src/pages/Account.jsx +++ b/frontend/src/pages/Account.jsx @@ -38,6 +38,10 @@ export default function Account() { } } const fetchUserHistory = async () => { + if (!user.id || !token) { + console.warn("User ID or token missing, skipping history fetch"); + return; + } try { const response = await fetch(`/api/users/${user.id}/history`, { method: "GET", @@ -52,7 +56,6 @@ export default function Account() { setUserHistory(data); } catch (error) { console.error("Error fetching user history:", error); - return null; } } const fetchUserPlaylists = async () => {