refactor: Remove unnecessary keys from theme object in get-theme API route

This commit is contained in:
mauro-balades
2024-08-27 17:43:02 +02:00
parent e85c483c78
commit 1087dbb076

View File

@@ -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 } }) { export async function GET(request: any, { params }: { params: { id: string } }) {
const themes = await getAllThemes(); const themes = await getAllThemes();
const theme = themes.find((theme) => theme.id === params.id); const theme = themes.find((theme) => theme.id === params.id);
console.log(theme); console.log(theme);
return NextResponse.json(theme); return NextResponse.json(removeUneccessaryKeys(theme));
} }