mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-31 08:04:54 +02:00
store last visited org in cookie
This commit is contained in:
parent
34180ca454
commit
9bb4d8b2a3
6 changed files with 14229 additions and 14065 deletions
19
src/components/SetLastOrgCookie.tsx
Normal file
19
src/components/SetLastOrgCookie.tsx
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue