Files
frontend/apps/sn/app/components/lib/utils/cookie.tsx
T
yschoi 7a3beb2f9d
iipbs_sn / build (push) Waiting to run
파일업로드 유틸 추가
2025-05-21 11:28:28 +09:00

30 lines
579 B
TypeScript

import Cookies from "js-cookie";
export function getCookie(name: string): string | undefined {
if (typeof window === "undefined") {
return undefined;
}
return Cookies.get(name);
}
export function setCookie(
name: string,
value: string,
options?: Cookies.CookieAttributes,
): void {
if (typeof window === "undefined") {
return;
}
Cookies.set(name, value, options);
}
export function removeCookie(
name: string,
options?: Cookies.CookieAttributes,
): void {
if (typeof window === "undefined") {
return;
}
Cookies.remove(name, options);
}