useEntityActions: fix isLoading
This commit is contained in:
parent
1c5a6d8b41
commit
b4c3248791
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue