Files
payload/test/versions/globals/Draft.ts
2022-11-22 09:13:41 -05:00

32 lines
606 B
TypeScript

import { GlobalConfig } from '../../../src/globals/config/types';
const DraftGlobal: GlobalConfig = {
slug: 'draft-global',
label: 'Draft Global',
preview: () => 'https://payloadcms.com',
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;