Files
klz-cables.com/.pnpm-store/v10/files/24/d4cca1f448f43211a53d3705957ccde94d547ca313f7a89094a1d175cbc92ef5e62634a0ac8c440256c4cee506371ce6f7af719df1df56a609aa9ce304f095
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

28 lines
891 B
Plaintext

import { getAcceptLanguageLocale } from './resolveLocale.js';
function syncCookie(request, response, locale, routing, domain) {
if (!routing.localeCookie) return;
const {
name,
...rest
} = routing.localeCookie;
const hasLocaleCookie = request.cookies.has(name);
const hasOutdatedCookie = hasLocaleCookie && request.cookies.get(name)?.value !== locale;
if (hasOutdatedCookie) {
response.cookies.set(name, locale, {
path: request.nextUrl.basePath || undefined,
...rest
});
} else if (!hasLocaleCookie) {
const acceptLanguageLocale = getAcceptLanguageLocale(request.headers, domain?.locales || routing.locales, routing.defaultLocale);
if (acceptLanguageLocale !== locale) {
response.cookies.set(name, locale, {
path: request.nextUrl.basePath || undefined,
...rest
});
}
}
}
export { syncCookie as default };