import { createCookie } from "@remix-run/node";

export const activeProjectCookie = createCookie("activeProject", {
  maxAge: 60 * 60 * 24 * 365,
  path: "/",
});

export const getActiveProject = async (request: Request): Promise<string | undefined> => {
  const cookieValue = await activeProjectCookie.parse(request.headers.get("Cookie") || "");
  return cookieValue || undefined;
};
