feat(v4): Update the help center portal design (#10296)
Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import articlesAPI from 'dashboard/api/helpCenter/articles';
|
||||
import { uploadExternalImage, uploadFile } from 'dashboard/helper/uploadHelper';
|
||||
import { throwErrorMessage } from 'dashboard/store/utils/api';
|
||||
import camelcaseKeys from 'camelcase-keys';
|
||||
|
||||
import types from '../../mutation-types';
|
||||
export const actions = {
|
||||
@@ -10,9 +11,7 @@ export const actions = {
|
||||
) => {
|
||||
try {
|
||||
commit(types.SET_UI_FLAG, { isFetching: true });
|
||||
const {
|
||||
data: { payload, meta },
|
||||
} = await articlesAPI.getArticles({
|
||||
const { data } = await articlesAPI.getArticles({
|
||||
pageNumber,
|
||||
portalSlug,
|
||||
locale,
|
||||
@@ -20,6 +19,8 @@ export const actions = {
|
||||
authorId,
|
||||
categorySlug,
|
||||
});
|
||||
const payload = camelcaseKeys(data.payload);
|
||||
const meta = camelcaseKeys(data.meta);
|
||||
const articleIds = payload.map(article => article.id);
|
||||
commit(types.CLEAR_ARTICLES);
|
||||
commit(types.ADD_MANY_ARTICLES, payload);
|
||||
@@ -36,12 +37,11 @@ export const actions = {
|
||||
create: async ({ commit, dispatch }, { portalSlug, ...articleObj }) => {
|
||||
commit(types.SET_UI_FLAG, { isCreating: true });
|
||||
try {
|
||||
const {
|
||||
data: { payload },
|
||||
} = await articlesAPI.createArticle({
|
||||
const { data } = await articlesAPI.createArticle({
|
||||
portalSlug,
|
||||
articleObj,
|
||||
});
|
||||
const payload = camelcaseKeys(data.payload);
|
||||
const { id: articleId } = payload;
|
||||
commit(types.ADD_ARTICLE, payload);
|
||||
commit(types.ADD_ARTICLE_ID, articleId);
|
||||
@@ -58,10 +58,8 @@ export const actions = {
|
||||
show: async ({ commit }, { id, portalSlug }) => {
|
||||
commit(types.SET_UI_FLAG, { isFetching: true });
|
||||
try {
|
||||
const response = await articlesAPI.getArticle({ id, portalSlug });
|
||||
const {
|
||||
data: { payload },
|
||||
} = response;
|
||||
const { data } = await articlesAPI.getArticle({ id, portalSlug });
|
||||
const payload = camelcaseKeys(data.payload);
|
||||
const { id: articleId } = payload;
|
||||
commit(types.ADD_ARTICLE, payload);
|
||||
commit(types.ADD_ARTICLE_ID, articleId);
|
||||
@@ -80,14 +78,12 @@ export const actions = {
|
||||
});
|
||||
|
||||
try {
|
||||
const {
|
||||
data: { payload },
|
||||
} = await articlesAPI.updateArticle({
|
||||
const { data } = await articlesAPI.updateArticle({
|
||||
portalSlug,
|
||||
articleId,
|
||||
articleObj,
|
||||
});
|
||||
|
||||
const payload = camelcaseKeys(data.payload);
|
||||
commit(types.UPDATE_ARTICLE, payload);
|
||||
|
||||
return articleId;
|
||||
|
||||
Reference in New Issue
Block a user