feat: refactoring, soem work on forms

This commit is contained in:
2026-09-13 23:17:37 +02:00
parent fa07d4cc0b
commit 0dbbe5361a
17 changed files with 260 additions and 116 deletions
+27
View File
@@ -0,0 +1,27 @@
import { deleteCookie, getCookies, setCookie } from "@std/http/cookie";
export function setAuthCookie(
headers: Headers,
) {
setCookie(headers, {
name: "auth",
value: "ok",
maxAge: 60 * 60,
sameSite: "Lax",
path: "/",
secure: true,
httpOnly: true,
});
}
export function unsetAuthCookie(headers: Headers) {
deleteCookie(headers, "auth", {
path: "/",
});
}
export function isLoggedIn(req: Request): boolean {
const cookies = getCookies(req.headers);
const authCookie = cookies["auth"];
return authCookie === "ok";
}