Skip to main content
Version: 2.0.0

Function: saveEntityWithCallbacks

saveEntityWithCallbacks<M, UserType>(«destructured»): Promise<void>

This function is in charge of saving an entity to the datasource. It will run all the save callbacks specified in the collection. It is also possible to attach callbacks on save success or error, and callback errors.

If you just want to save the data without running the onSaveSuccess, onSaveFailure and onPreSave callbacks, you can use the saveEntity method in the datasource (useDataSource).

See

useDataSource

Type parameters

NameType
Mextends Record<string, any>
UserTypeextends User

Parameters

NameType
«destructured»SaveEntityProps<M> & { callbacks?: EntityCallbacks<M, User> ; onPreSaveHookError?: (e: Error) => void ; onSaveFailure?: (e: Error) => void ; onSaveSuccess?: (updatedEntity: Entity<M>) => void ; onSaveSuccessHookError?: (e: Error) => void } & { context: FireCMSContext<UserType> ; dataSource: DataSource }

Returns

Promise<void>

Defined in

lib/src/hooks/data/save.ts:52

Enterprise or start-up?

Learn how to get the most out of your project with the help of our consulting team.
Learn more
Sign up to our newsletter to get the latest news and updates. No spam!