"use server";

import { cookies } from "next/headers";

export const setSessionIdToCookie = async (
  key: string,
  value: string
): Promise<void> => {
  const cookieStore = await cookies();
  cookieStore.set(key, value, {
    httpOnly: true,
    secure: process.env.NODE_ENV === "production",
    path: "/",
    sameSite: "lax",
    maxAge: 60 * 60 * 24 * 365,
  });
};
