feat: Portals store integration (#5185)

This commit is contained in:
Muhsin Keloth
2022-08-08 15:47:32 +05:30
committed by GitHub
parent 052422ed03
commit 20f3568583
30 changed files with 982 additions and 413 deletions

View File

@@ -1,18 +1,22 @@
import PortalAPI from 'dashboard/api/helpCenter/portals';
import articlesAPI from 'dashboard/api/helpCenter/articles';
import { throwErrorMessage } from 'dashboard/store/utils/api';
const portalAPIs = new PortalAPI();
import types from '../../mutation-types';
export const actions = {
index: async ({ commit }, { pageNumber, portalSlug, locale }) => {
index: async (
{ commit },
{ pageNumber, portalSlug, locale, status, author_id }
) => {
try {
commit(types.SET_UI_FLAG, { isFetching: true });
const {
data: { payload, meta },
} = await portalAPIs.getArticles({
} = await articlesAPI.getArticles({
pageNumber,
portalSlug,
locale,
status,
author_id,
});
const articleIds = payload.map(article => article.id);
commit(types.CLEAR_ARTICLES);