From cf9b62886cffdbbc1f62df86a8931709a71b81ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mauro=20=F0=9F=A4=99?= <91018726+mauro-balades@users.noreply.github.com> Date: Wed, 28 Aug 2024 12:48:09 +0000 Subject: [PATCH] remove API --- src/app/api/get-theme/[id]/route.ts | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 src/app/api/get-theme/[id]/route.ts diff --git a/src/app/api/get-theme/[id]/route.ts b/src/app/api/get-theme/[id]/route.ts deleted file mode 100644 index 78c7a69..0000000 --- a/src/app/api/get-theme/[id]/route.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { getAllThemes, getThemeFromId } from '@/lib/themes'; -import type { NextApiRequest, NextApiResponse } from 'next'; -import { NextRequest, NextResponse } from 'next/server'; - -// Static NextJS API route. We will have /get-theme?id=theme-id static route -export async function generateStaticParams() { - const themes = await getAllThemes(); - return themes.map((theme) => ({ - id: theme.id, - })); -} - - -function removeUneccessaryKeys(theme: any) { - delete theme["isDarkMode"]; - delete theme["isColorTheme"]; - return theme; -} - -export async function GET(request: any, { params }: { params: { id: string } }) { - const themes = await getAllThemes(); - const theme = themes.find((theme) => theme.id === params.id); - console.log(theme); - return NextResponse.json(removeUneccessaryKeys(theme)); -} \ No newline at end of file