EntityCallbacks
@firecms/core / EntityCallbacks
Type Alias: EntityCallbacks<M, USER>
Section titled “Type Alias: EntityCallbacks<M, USER>”EntityCallbacks<
M,USER> =object
Defined in: types/entity_callbacks.ts:13
This interface defines all the callbacks that can be used when an entity is being created, updated or deleted. Useful for adding your own logic or blocking the execution of the operation.
Type Parameters
Section titled “Type Parameters”M extends Record<string, any> = any
Methods
Section titled “Methods”onDelete()?
Section titled “onDelete()?”
optionalonDelete(entityDeleteProps):void
Defined in: types/entity_callbacks.ts:59
Callback used after the entity is deleted.
Parameters
Section titled “Parameters”entityDeleteProps
Section titled “entityDeleteProps”EntityOnDeleteProps<M, USER>
Returns
Section titled “Returns”void
onFetch()?
Section titled “onFetch()?”
optionalonFetch(entityFetchProps):Entity<M> |Promise<Entity<M>>
Defined in: types/entity_callbacks.ts:19
Callback used after fetching data
Parameters
Section titled “Parameters”entityFetchProps
Section titled “entityFetchProps”EntityOnFetchProps<M, USER>
Returns
Section titled “Returns”Entity<M> | Promise<Entity<M>>
onIdUpdate()?
Section titled “onIdUpdate()?”
optionalonIdUpdate(idUpdateProps):string|Promise<string>
Defined in: types/entity_callbacks.ts:68
Callback fired when any value in the form changes. You can use it
to define the ID of a new entity based on the current values.
The returned string will be used as the ID of the entity.
Parameters
Section titled “Parameters”idUpdateProps
Section titled “idUpdateProps”Returns
Section titled “Returns”string | Promise<string>
onPreDelete()?
Section titled “onPreDelete()?”
optionalonPreDelete(entityDeleteProps):void
Defined in: types/entity_callbacks.ts:52
Callback used after the entity is deleted. If you throw an error in this method the process stops, and an error snackbar gets displayed.
Parameters
Section titled “Parameters”entityDeleteProps
Section titled “entityDeleteProps”EntityOnDeleteProps<M, USER>
Returns
Section titled “Returns”void
onPreSave()?
Section titled “onPreSave()?”
optionalonPreSave(entitySaveProps):Partial<M> |Promise<Partial<M>>
Defined in: types/entity_callbacks.ts:42
Callback used before saving, you need to return the values that will get saved. If you throw an error in this method the process stops, and an error snackbar gets displayed.
Parameters
Section titled “Parameters”entitySaveProps
Section titled “entitySaveProps”EntityOnPreSaveProps<M, USER>
Returns
Section titled “Returns”Partial<M> | Promise<Partial<M>>
onSaveFailure()?
Section titled “onSaveFailure()?”
optionalonSaveFailure(entitySaveProps):void|Promise<void>
Defined in: types/entity_callbacks.ts:33
Callback used when saving fails
Parameters
Section titled “Parameters”entitySaveProps
Section titled “entitySaveProps”EntityOnSaveFailureProps<M, USER>
Returns
Section titled “Returns”void | Promise<void>
onSaveSuccess()?
Section titled “onSaveSuccess()?”
optionalonSaveSuccess(entitySaveProps):void|Promise<void>
Defined in: types/entity_callbacks.ts:26
Callback used when save is successful
Parameters
Section titled “Parameters”entitySaveProps
Section titled “entitySaveProps”EntityOnSaveProps<M, USER>
Returns
Section titled “Returns”void | Promise<void>