From 4e8952b54b0fbf5b4646974fb94a10deeda21e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20M=C3=A1rquez?= <47191295+gustavomm19@users.noreply.github.com> Date: Tue, 7 Jan 2025 12:35:38 +0000 Subject: [PATCH] remove duplicated academies when fetching the services --- src/js_modules/profile/Subscriptions/index.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js_modules/profile/Subscriptions/index.jsx b/src/js_modules/profile/Subscriptions/index.jsx index c8b70c0f6..eee34f4d7 100644 --- a/src/js_modules/profile/Subscriptions/index.jsx +++ b/src/js_modules/profile/Subscriptions/index.jsx @@ -66,6 +66,7 @@ function Subscriptions({ cohorts }) { const getConsumables = async () => { try { const nonSaasCohorts = cohorts.filter(({ available_as_saas }) => !available_as_saas); + const academies = [...new Set(nonSaasCohorts.map(({ academy }) => academy.id))]; const allServices = { nonSaasMentorships: [], @@ -73,7 +74,7 @@ function Subscriptions({ cohorts }) { workshops: [], }; - const cohortsServices = nonSaasCohorts.map(({ academy }) => bc.mentorship({ academy: academy.id }, true).getService()); + const cohortsServices = academies.map((academy) => bc.mentorship({ academy }, true).getService()); const responseServices = await Promise.all(cohortsServices); const nonSaasServices = responseServices.flatMap(({ data }) => data);