Skip to content

Commit

Permalink
fix api
Browse files Browse the repository at this point in the history
  • Loading branch information
mmvergara committed Jun 22, 2024
1 parent 458f168 commit b540369
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/api/generate/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export const GET = async (req: Request): Promise<NextResponse> => {
}
);
}
const data = (await res.json()) as Definitions;
const data = await res.json();
if (!data.definitions) {
return NextResponse.json({ data: null, error: "No definitions found" });
}

const outputCode = await generateClassesAndClient(data, isDart);
const outputCode = await generateClassesAndClient(data.definitions, isDart);
return NextResponse.json(
{ data: outputCode, error: null },
{ status: 200 }
Expand Down

0 comments on commit b540369

Please sign in to comment.