chore: Helpcenter improvements (#6098)
This commit is contained in:
parent
6a78254701
commit
8c88344170
5 changed files with 30 additions and 3 deletions
|
@ -227,6 +227,26 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
'$route.name'() {
|
||||||
|
const routeName = this.$route?.name;
|
||||||
|
const routeParams = this.$route?.params;
|
||||||
|
const updateMetaInAllPortals = routeName === 'list_all_portals';
|
||||||
|
const updateMetaInEditArticle =
|
||||||
|
routeName === 'edit_article' && routeParams?.recentlyCreated;
|
||||||
|
const updateMetaInLocaleArticles =
|
||||||
|
routeName === 'list_all_locale_articles' &&
|
||||||
|
routeParams?.recentlyDeleted;
|
||||||
|
if (
|
||||||
|
updateMetaInAllPortals ||
|
||||||
|
updateMetaInEditArticle ||
|
||||||
|
updateMetaInLocaleArticles
|
||||||
|
) {
|
||||||
|
this.fetchPortalAndItsCategories();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('resize', this.handleResize);
|
window.addEventListener('resize', this.handleResize);
|
||||||
this.handleResize();
|
this.handleResize();
|
||||||
|
|
|
@ -236,8 +236,10 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
articleCount() {
|
articleCount() {
|
||||||
const { all_articles_count: count } = this.portal.meta;
|
const { allowed_locales: allowedLocales } = this.portal.config;
|
||||||
return count;
|
return allowedLocales.reduce((acc, locale) => {
|
||||||
|
return acc + locale.articles_count;
|
||||||
|
}, 0);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -105,7 +105,10 @@ export default {
|
||||||
return this.portal?.config?.allowed_locales;
|
return this.portal?.config?.allowed_locales;
|
||||||
},
|
},
|
||||||
articlesCount() {
|
articlesCount() {
|
||||||
return this.portal?.meta?.all_articles_count;
|
const { allowed_locales: allowedLocales } = this.portal.config;
|
||||||
|
return allowedLocales.reduce((acc, locale) => {
|
||||||
|
return acc + locale.articles_count;
|
||||||
|
}, 0);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
@ -151,6 +151,7 @@ export default {
|
||||||
params: {
|
params: {
|
||||||
portalSlug: this.selectedPortalSlug,
|
portalSlug: this.selectedPortalSlug,
|
||||||
locale: this.locale,
|
locale: this.locale,
|
||||||
|
recentlyDeleted: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -87,6 +87,7 @@ export default {
|
||||||
articleSlug: articleId,
|
articleSlug: articleId,
|
||||||
portalSlug: this.selectedPortalSlug,
|
portalSlug: this.selectedPortalSlug,
|
||||||
locale: this.locale,
|
locale: this.locale,
|
||||||
|
recentlyCreated: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in a new issue