Files
payloadcms/test/versions/globals/Draft.ts
2022-10-06 16:11:24 -04:00

31 lines
563 B
TypeScript

import { GlobalConfig } from '../../../src/globals/config/types';
const DraftGlobal: GlobalConfig = {
slug: 'draft-global',
label: 'Draft Global',
versions: {
max: 20,
drafts: true,
},
access: {
read: ({ draft, req: { user } }) => {
// To read a draft of this global, you need to be authenticated
if (draft) {
return Boolean(user);
}
return true;
},
},
fields: [
{
name: 'title',
type: 'text',
required: true,
localized: true,
},
],
};
export default DraftGlobal;