Skip to content

EntityCallbacks

@firecms/core


@firecms/core / EntityCallbacks

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.

M extends Record<string, any> = any

USER extends User = User

optional onDelete(entityDeleteProps): void

Defined in: types/entity_callbacks.ts:59

Callback used after the entity is deleted.

EntityOnDeleteProps<M, USER>

void


optional onFetch(entityFetchProps): Entity<M> | Promise<Entity<M>>

Defined in: types/entity_callbacks.ts:19

Callback used after fetching data

EntityOnFetchProps<M, USER>

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


optional onIdUpdate(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.

EntityIdUpdateProps<M>

string | Promise<string>


optional onPreDelete(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.

EntityOnDeleteProps<M, USER>

void


optional onPreSave(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.

EntityOnPreSaveProps<M, USER>

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


optional onSaveFailure(entitySaveProps): void | Promise<void>

Defined in: types/entity_callbacks.ts:33

Callback used when saving fails

EntityOnSaveFailureProps<M, USER>

void | Promise<void>


optional onSaveSuccess(entitySaveProps): void | Promise<void>

Defined in: types/entity_callbacks.ts:26

Callback used when save is successful

EntityOnSaveProps<M, USER>

void | Promise<void>