@payloadcms/plugin-multi-tenant
Version:
Multi Tenant plugin for Payload
19 lines (18 loc) • 632 B
JavaScript
import { getCollectionIDType } from '../utilities/getCollectionIDType.js';
import { getTenantFromCookie } from '../utilities/getTenantFromCookie.js';
export const filterTenantsBySelectedTenant = ({ req, tenantsCollectionSlug })=>{
const idType = getCollectionIDType({
collectionSlug: tenantsCollectionSlug,
payload: req.payload
});
const selectedTenant = getTenantFromCookie(req.headers, idType);
if (selectedTenant) {
return {
id: {
equals: selectedTenant
}
};
}
return {};
};
//# sourceMappingURL=filterTenantsBySelectedTenant.js.map