Check for invalid theme values in middleware
This commit is contained in:
parent
a6254b3e6e
commit
969fab85ba
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user