Skip to main content
Version: 3.0.0-beta

Type Alias: EntityCallbacks<M, UserType>

EntityCallbacks<M, UserType>: object

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​

• M extends Record<string, any> = any

• UserType extends User = User

Type declaration​

onDelete()?​

Callback used after the entity is deleted.

Parameters​

• entityDeleteProps: EntityOnDeleteProps<M, UserType>

Returns​

void

onFetch()?​

Callback used after fetching data

Parameters​

• entityFetchProps: EntityOnFetchProps<M, UserType>

Returns​

Entity<M> | Promise<Entity<M>>

onIdUpdate()?​

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​

• idUpdateProps: EntityIdUpdateProps<M>

Returns​

string | Promise<string>

onPreDelete()?​

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​

• entityDeleteProps: EntityOnDeleteProps<M, UserType>

Returns​

void

onPreSave()?​

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​

• entitySaveProps: EntityOnPreSaveProps<M, UserType>

Returns​

Partial<M> | Promise<Partial<M>>

onSaveFailure()?​

Callback used when saving fails

Parameters​

• entitySaveProps: EntityOnSaveFailureProps<M, UserType>

Returns​

void | Promise<void>

onSaveSuccess()?​

Callback used when save is successful

Parameters​

• entitySaveProps: EntityOnSaveProps<M, UserType>

Returns​

void | Promise<void>

Defined in​

packages/firecms_core/src/types/entity_callbacks.ts:13

Sign up to our newsletter to get the latest news and updates. No spam!