chore: Category store fixes
This commit is contained in:
parent
ba0fc3552d
commit
c640b7134f
4 changed files with 11 additions and 11 deletions
|
@ -243,6 +243,7 @@ export default {
|
|||
this.$emit('open-site');
|
||||
},
|
||||
openSettings() {
|
||||
this.fetchPortalsAndItsCategories();
|
||||
this.navigateToPortalEdit();
|
||||
},
|
||||
onClickOpenDeleteModal(portal) {
|
||||
|
@ -252,6 +253,13 @@ export default {
|
|||
closeDeletePopup() {
|
||||
this.showDeleteConfirmationPopup = false;
|
||||
},
|
||||
fetchPortalsAndItsCategories() {
|
||||
this.$store.dispatch('portals/index').then(() => {
|
||||
this.$store.dispatch('categories/index', {
|
||||
portalSlug: this.portal.slug,
|
||||
});
|
||||
});
|
||||
},
|
||||
async onClickDeletePortal() {
|
||||
const { slug } = this.selectedPortalForDelete;
|
||||
try {
|
||||
|
|
|
@ -113,18 +113,7 @@ export default {
|
|||
return this.allLocales.map(locale => locale.code);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// this.fetchCategories();
|
||||
this.$store.getters['categories/categoriesByLocaleCode'](
|
||||
this.currentLocaleCode
|
||||
);
|
||||
},
|
||||
methods: {
|
||||
fetchCategories() {
|
||||
this.$store.dispatch('categories/index', {
|
||||
portalSlug: this.currentPortalSlug,
|
||||
});
|
||||
},
|
||||
openAddCategoryModal() {
|
||||
this.showAddCategoryModal = true;
|
||||
},
|
||||
|
|
|
@ -9,6 +9,7 @@ export const actions = {
|
|||
const {
|
||||
data: { payload },
|
||||
} = await categoriesAPI.get({ portalSlug });
|
||||
commit(types.CLEAR_CATEGORIES);
|
||||
const categoryIds = payload.map(category => category.id);
|
||||
commit(types.ADD_MANY_CATEGORIES, payload);
|
||||
commit(types.ADD_MANY_CATEGORIES_ID, categoryIds);
|
||||
|
|
|
@ -234,12 +234,14 @@ export default {
|
|||
REMOVE_ARTICLE: 'REMOVE_ARTICLE',
|
||||
REMOVE_ARTICLE_ID: 'REMOVE_ARTICLE_ID',
|
||||
SET_UI_FLAG: 'SET_UI_FLAG',
|
||||
|
||||
// Help Center -- Categories
|
||||
ADD_CATEGORY: 'ADD_CATEGORY',
|
||||
ADD_CATEGORY_ID: 'ADD_CATEGORY_ID',
|
||||
ADD_MANY_CATEGORIES: 'ADD_MANY_CATEGORIES',
|
||||
ADD_MANY_CATEGORIES_ID: 'ADD_MANY_CATEGORIES_ID',
|
||||
ADD_CATEGORY_FLAG: 'ADD_CATEGORY_FLAG',
|
||||
CLEAR_CATEGORIES: 'CLEAR_CATEGORIES',
|
||||
UPDATE_CATEGORY: 'UPDATE_CATEGORY',
|
||||
REMOVE_CATEGORY: 'REMOVE_CATEGORY',
|
||||
REMOVE_CATEGORY_ID: 'REMOVE_CATEGORY_ID',
|
||||
|
|
Loading…
Reference in a new issue