Skip to main content
Version: 2.0.0-alpha

Interface: EntityCallbacks<M, UserType>

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

NameType
Mextends Object = any
UserTypeextends User = User

Methods

onDelete

Optional onDelete(entityDeleteProps): void

Callback used after the entity is deleted.

Parameters

NameType
entityDeletePropsEntityOnDeleteProps<M, UserType>

Returns

void

Defined in

lib/src/models/entity_callbacks.ts:51


onPreDelete

Optional onPreDelete(entityDeleteProps): void

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

NameType
entityDeletePropsEntityOnDeleteProps<M, UserType>

Returns

void

Defined in

lib/src/models/entity_callbacks.ts:44


onPreSave

Optional onPreSave(entitySaveProps): Partial<M> | Promise<Partial<M>>

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

NameType
entitySavePropsEntityOnSaveProps<M, UserType>

Returns

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

Defined in

lib/src/models/entity_callbacks.ts:34


onSaveFailure

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

Callback used when saving fails

Parameters

NameType
entitySavePropsEntityOnSaveProps<M, UserType>

Returns

void | Promise<void>

Defined in

lib/src/models/entity_callbacks.ts:25


onSaveSuccess

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

Callback used when save is successful

Parameters

NameType
entitySavePropsEntityOnSaveProps<M, UserType>

Returns

void | Promise<void>

Defined in

lib/src/models/entity_callbacks.ts:18