32 lines
558 B
TypeScript
32 lines
558 B
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
export const autosavePostsSlug = 'autosave-posts'
|
|
|
|
export const AutosavePostsCollection: CollectionConfig = {
|
|
slug: autosavePostsSlug,
|
|
admin: {
|
|
useAsTitle: 'title',
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
},
|
|
{
|
|
name: 'computedTitle',
|
|
type: 'text',
|
|
hooks: {
|
|
beforeChange: [({ data }) => data?.title],
|
|
},
|
|
label: 'Computed Title',
|
|
},
|
|
],
|
|
versions: {
|
|
drafts: {
|
|
autosave: {
|
|
interval: 100,
|
|
},
|
|
},
|
|
},
|
|
}
|