Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Check for invalid theme values in middleware
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent a6254b3 commit 969fab8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion functions/_middleware.ts
Expand Up @@ -126,7 +126,7 @@ async function setTheme(context: RequestContext) {
);
const theme = themeCookie?.split("=").at(1);

if (!theme) context.data.theme = "dark";
if (!theme || !["dark", "light"].includes(theme)) context.data.theme = "dark";
else context.data.theme = theme;

return await context.next();
Expand Down

0 comments on commit 969fab8

Please sign in to comment.