From 33295804b88500c06007aee0f0d67c48f26b0015 Mon Sep 17 00:00:00 2001 From: Payal Baldaniya Date: Tue, 17 Dec 2024 14:02:21 +0000 Subject: [PATCH] remove console and unused dummy stmt --- ...edgeManagementPortalCategoryController.php | 2 +- .../src/Pages/ViewCategory.vue | 29 ++++++++----------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/app-modules/portal/src/Http/Controllers/KnowledgeManagementPortal/KnowledgeManagementPortalCategoryController.php b/app-modules/portal/src/Http/Controllers/KnowledgeManagementPortal/KnowledgeManagementPortalCategoryController.php index 20128dad1..f03567640 100644 --- a/app-modules/portal/src/Http/Controllers/KnowledgeManagementPortal/KnowledgeManagementPortalCategoryController.php +++ b/app-modules/portal/src/Http/Controllers/KnowledgeManagementPortal/KnowledgeManagementPortalCategoryController.php @@ -74,7 +74,7 @@ public function show(KnowledgeBaseCategory $category): JsonResponse 'description' => $category->description, 'parent_id' => $category->parent_id, ]), - 'parentCategory' => $category?->parentCategory, + 'parentCategory' => $category->parentCategory, 'subCategories' => $category ->subCategories() ->get() diff --git a/portals/knowledge-management/src/Pages/ViewCategory.vue b/portals/knowledge-management/src/Pages/ViewCategory.vue index e37c78a8b..84218b444 100644 --- a/portals/knowledge-management/src/Pages/ViewCategory.vue +++ b/portals/knowledge-management/src/Pages/ViewCategory.vue @@ -85,7 +85,7 @@ const toArticle = ref(0); const filter = ref(''); const fromSearch = ref(false); - const parentCategory = ref({}); + const parentCategory = ref(null); const debounceSearch = debounce((value, page = 1) => { const { post } = consumer(); @@ -179,22 +179,15 @@ debounceSearch(searchQuery.value); }; - if(parentCategory.value){ - console.log('xx'); - } - - - // const breadcrumbs = computed(() => { - // if (parentCategory.value) { - // return [ - // { name: parentCategory.name, route: 'view-subcategory', params: { subCategorySlug: parentCategory.slug } }, - // ]; - // } - - // return [{name :'Ankit', slug:'default'}]; - // }); + const breadcrumbs = computed(() => { + if (parentCategory.value) { + return [ + { name: parentCategory.value.name, route: 'view-category', params: { categorySlug: parentCategory.value.slug } }, + ]; + } - // console.log('bred',breadcrumbs); + return []; + }); watch( route, @@ -209,15 +202,17 @@ ); async function getData(page = 1) { + if (fromSearch.value) { debounceSearch(searchQuery.value, page); return; } + loadingResults.value = true; const { get } = consumer(); const slug = route.params.categorySlug ?? route.params.subCategorySlug; - + await get(props.apiUrl + '/categories/' + slug, { page: page, filter: filter.value }).then( (response) => { if (response.data.category.slug !== slug) {