Skip to main content
Sublay supports a draft/publish workflow for entities. An entity created with isDraft: true is stored but not publicly visible. When the creator is ready, they publish it and it becomes visible to others.

Creating a Draft

Pass isDraft: true to useCreateEntity:

Listing the Current User’s Drafts

Use useFetchDrafts to retrieve all unpublished drafts for the authenticated user:
useFetchDrafts parameters: Returns a paginated response: { data: Entity[], pagination: { page, pageSize, totalPages, totalItems, hasMore } }.

Publishing a Draft

Use usePublishDraft to publish an existing draft:
After publishing, entity.isDraft is false and the entity is publicly visible.
Only the entity’s creator can publish their own drafts. The request requires an authenticated user.