From 1087dbb076d9786d761207747f98a7dcff0900eb Mon Sep 17 00:00:00 2001 From: mauro-balades Date: Tue, 27 Aug 2024 17:43:02 +0200 Subject: [PATCH] refactor: Remove unnecessary keys from theme object in get-theme API route --- src/app/api/get-theme/[id]/route.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/api/get-theme/[id]/route.ts b/src/app/api/get-theme/[id]/route.ts index 0a5d99c..78c7a69 100644 --- a/src/app/api/get-theme/[id]/route.ts +++ b/src/app/api/get-theme/[id]/route.ts @@ -10,9 +10,16 @@ export async function generateStaticParams() { })); } + +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(theme); + return NextResponse.json(removeUneccessaryKeys(theme)); } \ No newline at end of file