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