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
1 changed files with 2 additions and 0 deletions

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 create = useCreateEntity<TEntity, Data>(path, { method: 'post', url: endpoints.post }, opts);
const createEntity: typeof create = async (...args) => { const createEntity: typeof create = async (...args) => {
setIsLoading(true);
await create(...args); await create(...args);
setIsLoading(false); setIsLoading(false);
}; };
const deleteEntity: typeof _delete = async (...args) => { const deleteEntity: typeof _delete = async (...args) => {
setIsLoading(true);
await _delete(...args); await _delete(...args);
setIsLoading(false); setIsLoading(false);
}; };