diff --git a/app-modules/portal/src/Http/Controllers/KnowledgeManagementPortal/KnowledgeManagementPortalArticleController.php b/app-modules/portal/src/Http/Controllers/KnowledgeManagementPortal/KnowledgeManagementPortalArticleController.php index f8db18603..4d6672be0 100644 --- a/app-modules/portal/src/Http/Controllers/KnowledgeManagementPortal/KnowledgeManagementPortalArticleController.php +++ b/app-modules/portal/src/Http/Controllers/KnowledgeManagementPortal/KnowledgeManagementPortalArticleController.php @@ -50,6 +50,10 @@ public function show(KnowledgeBaseCategory $category, KnowledgeBaseItem $article { $article->increment('portal_view_count'); + if (! $article->public) { + return response()->json([], 401); + } + return response()->json([ 'category' => KnowledgeBaseCategoryData::from([ 'id' => $category->getKey(), diff --git a/portals/knowledge-management/src/Pages/ViewArticle.vue b/portals/knowledge-management/src/Pages/ViewArticle.vue index 45f5159c2..c461647ce 100644 --- a/portals/knowledge-management/src/Pages/ViewArticle.vue +++ b/portals/knowledge-management/src/Pages/ViewArticle.vue @@ -79,14 +79,23 @@ const { get } = consumer(); - get(props.apiUrl + '/categories/' + route.params.categoryId + '/articles/' + route.params.articleId).then( - (response) => { - category.value = response.data.category; - article.value = response.data.article; + get(props.apiUrl + '/categories/' + route.params.categoryId + '/articles/' + route.params.articleId) + .then((response) => { + if (response.data) { + category.value = response.data.category; + article.value = response.data.article; + portalViewCount.value = response.data.portal_view_count; + } + loading.value = false; - portalViewCount.value = response.data.portal_view_count; - }, - ); + }) + .catch((error) => { + if (error.response && error.response.status === 401) { + loading.value = false; + } else { + console.log('An error occurred', error); + } + }); } @@ -104,11 +113,12 @@ { name: category.name, route: 'view-category', params: { categoryId: category.id } }, ]" currentCrumb="Articles" + v-if="article" >
-
+

{{ article.name }}

@@ -124,6 +134,19 @@
+
+
+

+ The link you are attempting to access is invalid. +

+ + Return Home + +
+