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

45 lines
977 B
Plaintext

import { sanitizeID } from '@payloadcms/ui/shared';
export const getDocPreferences = async ({
id,
collectionSlug,
globalSlug,
payload,
user
}) => {
let preferencesKey;
if (collectionSlug && id) {
preferencesKey = `collection-${collectionSlug}-${id}`;
}
if (globalSlug) {
preferencesKey = `global-${globalSlug}`;
}
if (preferencesKey) {
const preferencesResult = await payload.find({
collection: 'payload-preferences',
depth: 0,
limit: 1,
where: {
and: [{
key: {
equals: preferencesKey
}
}, {
'user.relationTo': {
equals: user.collection
}
}, {
'user.value': {
equals: sanitizeID(user.id)
}
}]
}
});
if (preferencesResult?.docs?.[0]?.value) {
return preferencesResult.docs[0].value;
}
}
return {
fields: {}
};
};
//# sourceMappingURL=getDocPreferences.js.map