Files
openpanel/packages/live-previews/src/utils/development-cookie.ts
Stefan Pejcic 8496a83edb fork refine
2024-02-05 10:23:04 +01:00

13 lines
436 B
TypeScript

const DEVELOPMENT_MODE_COOKIE = "refine-live-preview-development-mode";
export const isDevelopmentModeByCookie = (): boolean => {
if (typeof document === "undefined") return false;
const cookie = document.cookie;
const parts = cookie.split(";");
const dev = parts.find((part) => part.includes(DEVELOPMENT_MODE_COOKIE));
if (!dev) return false;
const [, value] = dev.split("=");
return value === "true";
};