Skip to content

Commit

Permalink
Update page.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
cdedreuille committed Jul 19, 2024
1 parent a37b062 commit 33347a8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/addon-catalog/app/[...addonName]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { SubHeader } from '@repo/ui';
import { cn } from '@repo/utils';
import { createClient } from '@supabase/supabase-js';
import { fetchAddonDetailsData } from '../../lib/fetch-addon-details-data';
import { AddonHero } from '../../components/addon/addon-hero';
import { AddonSidebar } from '../../components/addon/addon-sidebar';
import { Highlight } from '../../components/highlight';
import { fetchMongodbAddons } from '../../lib/fetch-mongodb-addons';

interface AddonDetailsProps {
params: {
Expand All @@ -13,7 +13,15 @@ interface AddonDetailsProps {
}

export async function generateStaticParams() {
const { addons } = await fetchMongodbAddons();
const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
);
const { data: addons } = await supabase.from('addons').select();

if (!addons) return [];

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- TODO
return addons.map((addon) => ({ addonName: addon.name?.split('/') }));
}

Expand Down

0 comments on commit 33347a8

Please sign in to comment.