refactor: Remove unnecessary keys from theme object in get-theme route and update navigation component

This commit is contained in:
Mauro Balades
2024-08-22 21:27:37 +02:00
parent 7c4de05e3b
commit 30cde8f559
2 changed files with 8 additions and 2 deletions

View File

@@ -11,6 +11,12 @@ function getQSParamFromURL(
return urlParams.get(key);
}
function removeUneccessaryKeys(theme: any) {
delete theme["isDarkMode"];
delete theme["isColorTheme"];
return theme;
}
export async function GET(request: Request, response: Response) {
const id = getQSParamFromURL("id", request.url);
if (!id) {
@@ -20,5 +26,5 @@ export async function GET(request: Request, response: Response) {
if (!theme) {
return Response.json({ error: "theme not found" });
}
return Response.json( theme );
return Response.json(removeUneccessaryKeys(theme));
}