Fix theme cookie not saved after session closing

This commit is contained in:
Kalle 2022-10-27 18:12:36 +03:00
parent 6bacfe9717
commit b340f32ae3

View File

@ -4,6 +4,8 @@ import { isTheme } from "./provider";
import type { Theme } from "./provider";
import invariant from "tiny-invariant";
const TEN_YEARS_IN_SECONDS = 315_360_000;
if (process.env.NODE_ENV === "production") {
invariant(process.env["SESSION_SECRET"], "SESSION_SECRET is required");
}
@ -17,6 +19,7 @@ const themeStorage = createCookieSessionStorage({
sameSite: "lax",
path: "/",
httpOnly: true,
maxAge: TEN_YEARS_IN_SECONDS,
},
});