Skip to content

Commit

Permalink
Merge pull request #3 from Aayan-infotech/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
imtiyaz-Aayaninfotech authored Dec 23, 2024
2 parents 2a1937d + e561bc7 commit 40a3262
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/views/Categories_Management/SubSubCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,18 @@ const SubSubCategory = () => {

// Fetch all Sub-Sub-Categories when the component is mounted
useEffect(() => {
axios.get('http://44.196.64.110:7878/api/subSubCategories')
.then(response => {
setSubSubCategories(response.data);
})
.catch(error => {
console.error('Error fetching sub-sub-categories:', error);
});
fetchAllSubcategoriesData();
}, []);

const fetchAllSubcategoriesData=async()=>{
axios.get('http://44.196.64.110:7878/api/subSubCategories')
.then(response => {
setSubSubCategories(response.data);
})
.catch(error => {
console.error('Error fetching sub-sub-categories:', error);
});
}
// Handle Add Sub-Sub-Category
const handleAddSubSubCategory = () => {
const selectedCategory = categories.find((cat) => cat.name === category);
Expand All @@ -77,7 +80,8 @@ const SubSubCategory = () => {
axios
.post('http://44.196.64.110:7878/api/subSubCategories', payload)
.then((response) => {
setSubSubCategories([...subSubCategories, response.data]);
// setSubSubCategories([...subSubCategories, response.data]);
fetchAllSubcategoriesData();
setVisible(false);
resetForm();
})
Expand Down Expand Up @@ -197,8 +201,8 @@ const SubSubCategory = () => {
subSubCategories.map((subSubCategory, index) => (
<CTableRow key={index}>
<CTableDataCell>{index + 1}</CTableDataCell>
<CTableDataCell>{subSubCategory.category}</CTableDataCell>
<CTableDataCell>{subSubCategory.subCategory}</CTableDataCell>
<CTableDataCell>{subSubCategory.category_name}</CTableDataCell>
<CTableDataCell>{subSubCategory.sub_category_name}</CTableDataCell>
<CTableDataCell>{subSubCategory.name}</CTableDataCell>
<CTableDataCell>
{subSubCategory.image ? (
Expand Down

0 comments on commit 40a3262

Please sign in to comment.