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​
Name | Type |
---|---|
M | extends Record <string , any > = any |
UserType | extends User = User |
Methods​
onDelete​
â–¸ Optional
onDelete(entityDeleteProps
): void
Callback used after the entity is deleted.
Parameters​
Name | Type |
---|---|
entityDeleteProps | EntityOnDeleteProps <M , UserType > |
Returns​
void
Defined in​
lib/src/types/entity_callbacks.ts:59
onFetch​
â–¸ Optional
onFetch(entityFetchProps
): Entity
<M
> | Promise
<Entity
<M
>>
Callback used after fetching data
Parameters​
Name | Type |
---|---|
entityFetchProps | EntityOnFetchProps <M , UserType > |
Returns​
Entity
<M
> | Promise
<Entity
<M
>>
Defined in​
lib/src/types/entity_callbacks.ts:19
onIdUpdate​
â–¸ Optional
onIdUpdate(idUpdateProps
): string
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​
Name | Type |
---|---|
idUpdateProps | EntityIdUpdateProps <M > |
Returns​
string
Defined in​
lib/src/types/entity_callbacks.ts:68
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​
Name | Type |
---|---|
entityDeleteProps | EntityOnDeleteProps <M , UserType > |
Returns​
void
Defined in​
lib/src/types/entity_callbacks.ts:52
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​
Name | Type |
---|---|
entitySaveProps | EntityOnSaveProps <M , UserType > |
Returns​
Partial
<M
> | Promise
<Partial
<M
>>
Defined in​
lib/src/types/entity_callbacks.ts:42
onSaveFailure​
â–¸ Optional
onSaveFailure(entitySaveProps
): void
| Promise
<void
>
Callback used when saving fails
Parameters​
Name | Type |
---|---|
entitySaveProps | EntityOnSaveProps <M , UserType > |
Returns​
void
| Promise
<void
>
Defined in​
lib/src/types/entity_callbacks.ts:33
onSaveSuccess​
â–¸ Optional
onSaveSuccess(entitySaveProps
): void
| Promise
<void
>
Callback used when save is successful
Parameters​
Name | Type |
---|---|
entitySaveProps | EntityOnSaveProps <M , UserType > |
Returns​
void
| Promise
<void
>