19 lines
681 B
JavaScript
19 lines
681 B
JavaScript
/**
|
|
* Thin wrapper over payload.findGlobal that keeps locale/depth handling in one
|
|
* place. The plugin never calls getPayload itself — the caller passes the
|
|
* instance (from getPayload in their app, or req.payload in a hook), matching
|
|
* the plugin's data-access rule: logic here, instance from outside.
|
|
*/ export async function getGlobal(payload, slug, options = {}) {
|
|
const result = await payload.findGlobal({
|
|
slug,
|
|
...options.locale ? {
|
|
locale: options.locale
|
|
} : {},
|
|
...typeof options.depth === 'number' ? {
|
|
depth: options.depth
|
|
} : {}
|
|
});
|
|
return result;
|
|
}
|
|
|
|
//# sourceMappingURL=getGlobal.js.map
|