Commit 523c9b52 authored by Omar Luna Hernández's avatar Omar Luna Hernández
Browse files

Se cambia la forma de actualizar la lista de categorias despues que se agrega o se elimina

parent f3d5ab70
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ export const useCategory = (forceRenderList?: () => void, handleClickToClose?: (
      try{
        await categoryRepository.registerCategory(data).then(() =>{
          if(forceRenderList && handleClickToClose){
            updateCategoriesList();
            forceRenderList();
            handleClickToClose();
          }
@@ -106,11 +107,8 @@ export const useCategory = (forceRenderList?: () => void, handleClickToClose?: (
  },[]);

  const deleteCategory = async (category: Category) => {
    setPending(true);
    await categoryRepository.deleteCategory(category);
    const categories = await categoryRepository.getCategories();
    setCategoriesList(categories);
    setPending(false);
    await updateCategoriesList();
  }

  return {