From 97596720f5c0ba5e5d6eebf64af2356a3f0e5a5b Mon Sep 17 00:00:00 2001 From: seaznCode Date: Fri, 20 Feb 2026 21:55:02 +0100 Subject: [PATCH] feat: add subscriptions display to profile page with loading and error handling --- src/app/profile/page.tsx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/app/profile/page.tsx b/src/app/profile/page.tsx index 1440b3a..0b88028 100644 --- a/src/app/profile/page.tsx +++ b/src/app/profile/page.tsx @@ -13,6 +13,7 @@ import EditModal from './components/editModal' import { getProfileCompletion } from './hooks/getProfileCompletion' import { useProfileData } from './hooks/getProfileData' import { useMedia } from './hooks/getMedia' +import { useMyAbonements } from './hooks/getAbo' import { editProfileBasic } from './hooks/editProfile' import { authFetch } from '../utils/authFetch' @@ -105,6 +106,7 @@ export default function ProfilePage() { // Fetch hooks can run with undefined userId; they should handle it internally const { data: profileDataApi, loading: profileLoading } = useProfileData(userId, refreshKey) const { data: mediaData, loading: mediaLoading } = useMedia(userId, refreshKey) + const { data: subscriptions, loading: subscriptionsLoading, error: subscriptionsError } = useMyAbonements(refreshKey) // Redirect only after hydration + auth ready useEffect(() => { @@ -407,6 +409,38 @@ export default function ProfilePage() { Open subscriptions + +
+ {subscriptionsLoading ? ( +

Loading subscriptions…

+ ) : subscriptionsError ? ( +

{subscriptionsError}

+ ) : subscriptions.length === 0 ? ( +

You don’t have any subscriptions yet.

+ ) : ( + + )} +
{/* --- Edit Bank Information Section --- */}