Skip to content

Commit

Permalink
fix: hardcoded values (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
pure-js authored Nov 9, 2024
1 parent a563de1 commit 92e41be
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/app/manufacturers/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import styles from '@/components/layout/grid.module.css';

export function generateStaticParams() {
return [{ id: '955' }, { id: '956' }, { id: '957' }]; // TODO: fix hardcoded values
import { getManufacturers } from '@/api';

interface Manufacturer {
Mfr_ID: number;
}

export async function generateStaticParams() {
const manufacturers = await getManufacturers().then((data) =>
data.Results.map((x: Manufacturer) => ({ id: x.Mfr_ID.toString() })),
);
return manufacturers;
}

export default async function Manufacturer({
Expand All @@ -10,6 +19,7 @@ export default async function Manufacturer({
params: Promise<{ id: string }>;
}) {
const { id } = await params;

return (
<main className={styles.container}>
<h1>{id}</h1>
Expand Down

0 comments on commit 92e41be

Please sign in to comment.