🧑‍💻 (dev) add helper for settingup a cookies

This commit is contained in:
2025-10-13 10:07:33 +07:00
parent 273db57e7b
commit 35b777e636
2 changed files with 17 additions and 10 deletions

View File

@ -0,0 +1,15 @@
"use server";
import { cookies } from "next/headers";
export const setCookie = async (name: string, value: string, sec?: number) => {
(await cookies()).set({
name,
value,
httpOnly: true,
secure: process.env.NODE_ENV === "production",
path: "/",
sameSite: "lax",
maxAge: sec || Number(process.env.SESSION_EXPIRE),
});
};