MCPcopy Create free account
hub / github.com/triggerdotdev/jsonhero-web / getThemeSession

Function getThemeSession

app/theme.server.ts:18–28  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

16});
17
18async function getThemeSession(request: Request) {
19 const session = await themeStorage.getSession(request.headers.get("Cookie"));
20 return {
21 getTheme: () => {
22 const themeValue = session.get("theme");
23 return isTheme(themeValue) ? themeValue : "dark";
24 },
25 setTheme: (theme: Theme) => session.set("theme", theme),
26 commit: () => themeStorage.commitSession(session),
27 };
28}
29
30export { getThemeSession };

Callers 2

loaderFunction · 0.90
actionFunction · 0.90

Calls 1

isThemeFunction · 0.90

Tested by

no test coverage detected