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
27 lines
648 B
Plaintext
27 lines
648 B
Plaintext
import { PREFERENCE_KEYS } from 'payload/shared';
|
|
import { cache } from 'react';
|
|
export const getNavPrefs = cache(async req => {
|
|
return req?.user?.collection ? await req.payload.find({
|
|
collection: 'payload-preferences',
|
|
depth: 0,
|
|
limit: 1,
|
|
pagination: false,
|
|
req,
|
|
where: {
|
|
and: [{
|
|
key: {
|
|
equals: PREFERENCE_KEYS.NAV
|
|
}
|
|
}, {
|
|
'user.relationTo': {
|
|
equals: req.user.collection
|
|
}
|
|
}, {
|
|
'user.value': {
|
|
equals: req?.user?.id
|
|
}
|
|
}]
|
|
}
|
|
})?.then(res => res?.docs?.[0]?.value) : null;
|
|
});
|
|
//# sourceMappingURL=getNavPrefs.js.map |