useCreateEntity
Overview
TheuseCreateEntity
hook is used to create a new entity within the project. It handles all required parameters for the creation process and associates the entity with the currently logged-in user.
Usage Example
Parameters & Returns
Parameters
The hook returns a function that accepts an object with the following fields:An optional foreign ID to associate with the entity.
An optional free-form source ID to group entities into separate entity “pools”.
The title of the entity.
The main content of the entity.
An array of objects representing attachments (e.g., images, videos, files) associated with the entity, with data about those attachments.
An array of keywords to tag the entity.
An array of user mentions in the entity.
The geographic location (latitude, longitude) associated with the entity.
Additional metadata to store with the entity.
By default, when this function is called, the ID of the logged in user is attached as the author, but it could be omitted by passing this flag as ‘false’.
Returns
The function resolves with an object representing the newly created entity:The details of the created entity, including its ID, title, and other attributes.