useEntityActions: fix isLoading

This commit is contained in:
Alex Gleason 2023-03-23 15:09:00 -05:00
parent 1c5a6d8b41
commit b4c3248791
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -28,11 +28,13 @@ function useEntityActions<TEntity extends Entity = Entity, Data = any>(
const create = useCreateEntity<TEntity, Data>(path, { method: 'post', url: endpoints.post }, opts);
const createEntity: typeof create = async (...args) => {
setIsLoading(true);
await create(...args);
setIsLoading(false);
};
const deleteEntity: typeof _delete = async (...args) => {
setIsLoading(true);
await _delete(...args);
setIsLoading(false);
};