Skip to content

Commit

Permalink
remove duplicated academies when fetching the services
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavomm19 committed Jan 7, 2025
1 parent d4d327a commit 4e8952b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js_modules/profile/Subscriptions/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ 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: [],
mentorships: [],
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);

Expand Down

0 comments on commit 4e8952b

Please sign in to comment.