diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue index b4626e108..8c806f23b 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue @@ -40,6 +40,7 @@ :portals="portals" :active-portal-slug="selectedPortalSlug" :active-locale="selectedLocaleInPortal" + @fetch-portal="fetchPortalAndItsCategories" @close-popover="closePortalPopover" /> { - this.$store.dispatch('categories/index', { - portalSlug: this.portal.slug, - }); - }); + async fetchPortalAndItsCategories() { + await this.$store.dispatch('portals/index'); + const { + slug, + config: { allowed_locales: allowedLocales }, + } = this.portal; + const selectedPortalParam = { + portalSlug: slug, + locale: allowedLocales[0].code, + }; + this.$store.dispatch('portals/show', selectedPortalParam); + this.$store.dispatch('categories/index', selectedPortalParam); }, async onClickDeletePortal() { const { slug } = this.selectedPortalForDelete; diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue index 67d1b33f1..729c641e7 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue @@ -36,7 +36,8 @@ :active-portal-slug="activePortalSlug" :active-locale="activeLocale" :active="portal.slug === activePortalSlug" - @open-portal-page="onPortalSelect" + @open-portal-page="closePortalPopover" + @fetch-portal="fetchPortalAndItsCategories" /> @@ -69,15 +70,15 @@ export default { closePortalPopover() { this.$emit('close-popover'); }, - onPortalSelect() { - this.$emit('close-popover'); - }, openPortalPage() { this.closePortalPopover(); this.$router.push({ name: 'list_all_portals', }); }, + fetchPortalAndItsCategories() { + this.$emit('fetch-portal'); + }, }, }; diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSettingsBasicForm.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSettingsBasicForm.vue index e13c60061..4e430da5d 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSettingsBasicForm.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSettingsBasicForm.vue @@ -16,7 +16,7 @@ {{ $t('HELP_CENTER.PORTAL.ADD.LOGO.LABEL') }}
- +
@@ -91,7 +91,7 @@ export default { currentPortalSlug() { return this.$route.params.portalSlug; }, - categoryByLocaleCode() { + categoriesByLocaleCode() { return this.$store.getters['categories/categoriesByLocaleCode']( this.currentLocaleCode ); @@ -131,6 +131,12 @@ export default { closeEditCategoryModal() { this.showEditCategoryModal = false; }, + async fetchCategoriesByPortalSlugAndLocale(localeCode) { + await this.$store.dispatch('categories/index', { + portalSlug: this.currentPortalSlug, + locale: localeCode, + }); + }, async deleteCategory(categoryId) { try { await this.$store.dispatch('categories/delete', { @@ -152,6 +158,7 @@ export default { changeCurrentCategory(event) { const localeCode = event.target.value; this.currentLocaleCode = localeCode; + this.fetchCategoriesByPortalSlugAndLocale(localeCode); }, }, }; diff --git a/app/javascript/dashboard/store/modules/helpCenterArticles/actions.js b/app/javascript/dashboard/store/modules/helpCenterArticles/actions.js index e62901835..3ab840105 100644 --- a/app/javascript/dashboard/store/modules/helpCenterArticles/actions.js +++ b/app/javascript/dashboard/store/modules/helpCenterArticles/actions.js @@ -41,11 +41,11 @@ export const actions = { portalSlug, articleObj, }); - const { id: articleId, portal } = payload; + const { id: articleId } = payload; commit(types.ADD_ARTICLE, payload); commit(types.ADD_ARTICLE_ID, articleId); commit(types.ADD_ARTICLE_FLAG, articleId); - dispatch('portals/updatePortal', portal, { root: true }); + dispatch('portals/updatePortal', portalSlug, { root: true }); return articleId; } catch (error) { return throwErrorMessage(error);