Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

541 B
Raw Blame
import "server-only";

import { cookies } from "next/headers";
import { FLASH_MAX_AGE, flashCookieName } from "@/lib/flash/constants";

// Server actions and route handlers only: a server component render cannot
// write cookies.
export async function setFlash(key: string, value: string) {
  const cookieStore = await cookies();
  cookieStore.set(flashCookieName(key), value, {
    path: "/",
    maxAge: FLASH_MAX_AGE,
    sameSite: "lax",
    httpOnly: false,
    secure: process.env.NEXT_PUBLIC_BASE_URL?.startsWith("https://"),
  });
}