03c8251cc3
* feat: Adds the ability to publish an article * chore: Disabled publish button and dropdown when there is no article id * chore: Review fixes * chore: Review fixes * Update app/javascript/dashboard/routes/dashboard/helpcenter/components/Header/EditArticleHeader.vue * chore: Review fixes Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
32 lines
1 KiB
JavaScript
32 lines
1 KiB
JavaScript
export const getters = {
|
|
uiFlags: state => helpCenterId => {
|
|
const uiFlags = state.articles.uiFlags.byId[helpCenterId];
|
|
if (uiFlags) return uiFlags;
|
|
return { isFetching: false, isUpdating: false, isDeleting: false };
|
|
},
|
|
isFetching: state => state.uiFlags.isFetching,
|
|
articleById: (...getterArguments) => articleId => {
|
|
const [state] = getterArguments;
|
|
const article = state.articles.byId[articleId];
|
|
if (!article) return undefined;
|
|
return article;
|
|
},
|
|
allArticles: (...getterArguments) => {
|
|
const [state, _getters] = getterArguments;
|
|
const articles = state.articles.allIds
|
|
.map(id => {
|
|
return _getters.articleById(id);
|
|
})
|
|
.filter(article => article !== undefined);
|
|
return articles;
|
|
},
|
|
articleStatus: (...getterArguments) => articleId => {
|
|
const [state] = getterArguments;
|
|
const article = state.articles.byId[articleId];
|
|
if (!article) return undefined;
|
|
return article.status;
|
|
},
|
|
getMeta: state => {
|
|
return state.meta;
|
|
},
|
|
};
|