mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
fork refine
This commit is contained in:
12
packages/live-previews/src/utils/development-cookie.ts
Normal file
12
packages/live-previews/src/utils/development-cookie.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
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";
|
||||
};
|
||||
Reference in New Issue
Block a user