From e69eff39e804be29c2745f0b82f84981f1391b28 Mon Sep 17 00:00:00 2001 From: Sacha GUERIN Date: Sun, 20 Jul 2025 21:12:23 +0000 Subject: [PATCH] Update frontend/src/pages/Account.jsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- frontend/src/pages/Account.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 () => {