error message
This commit is contained in:
@@ -8,17 +8,22 @@ import { Pages } from '../../config/Pages'
|
||||
import Button from '../../components/Button'
|
||||
import TrashWithConfrim from '../../components/TrashWithConfrim'
|
||||
import PageTitle from '../../components/PageTitle'
|
||||
import { toast } from 'react-toastify'
|
||||
import { extractErrorMessage } from '@/helpers/utils'
|
||||
|
||||
const CategoryList: FC = () => {
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { data, isLoading, refetch } = useGetCategories();
|
||||
const { data, isLoading } = useGetCategories();
|
||||
const deleteCategoryMutation = useDeleteCategory();
|
||||
const [expandedCategories, setExpandedCategories] = useState<Set<string>>(new Set());
|
||||
|
||||
const handleDeleteCategory = async (categoryId: string) => {
|
||||
await deleteCategoryMutation.mutateAsync(categoryId);
|
||||
refetch()
|
||||
await deleteCategoryMutation.mutateAsync(categoryId, {
|
||||
onError: (error) => {
|
||||
toast.error(extractErrorMessage(error));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const toggleExpanded = (categoryId: string) => {
|
||||
|
||||
Reference in New Issue
Block a user