Files
klz-cables.com/.pnpm-store/v10/files/4e/8a413dd44390b212e00547eeddc8b2252ad0fb13ae544fce725e54da0a2ec97535a9758a6f9577b59c03e47322ff36578c3746d095793b36275168b77cb54f
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

22 lines
797 B
Plaintext

import { defaultTheme } from '@payloadcms/ui';
const acceptedThemes = ['dark', 'light'];
export const getRequestTheme = ({
config,
cookies,
headers
}) => {
if (config.admin.theme !== 'all' && acceptedThemes.includes(config.admin.theme)) {
return config.admin.theme;
}
const themeCookie = cookies.get(`${config.cookiePrefix || 'payload'}-theme`);
const themeFromCookie = typeof themeCookie === 'string' ? themeCookie : themeCookie?.value;
if (themeFromCookie && acceptedThemes.includes(themeFromCookie)) {
return themeFromCookie;
}
const themeFromHeader = headers.get('Sec-CH-Prefers-Color-Scheme');
if (themeFromHeader && acceptedThemes.includes(themeFromHeader)) {
return themeFromHeader;
}
return defaultTheme;
};
//# sourceMappingURL=getRequestTheme.js.map