store last visited org in cookie

This commit is contained in:
miloschwartz 2025-06-24 14:54:07 -04:00
parent 34180ca454
commit 9bb4d8b2a3
No known key found for this signature in database
6 changed files with 14229 additions and 14065 deletions

View file

@ -0,0 +1,19 @@
"use client";
import { useEffect } from "react";
interface SetLastOrgCookieProps {
orgId: string;
}
export default function SetLastOrgCookie({ orgId }: SetLastOrgCookieProps) {
useEffect(() => {
const isSecure =
typeof window !== "undefined" &&
window.location.protocol === "https:";
document.cookie = `pangolin-last-org=${orgId}; path=/; max-age=${60 * 60 * 24 * 30}; samesite=lax${isSecure ? "; secure" : ""}`;
}, [orgId]);
return null;
}