2022-07-27 06:59:11 +00:00
|
|
|
export const getters = {
|
2022-08-02 11:44:10 +00:00
|
|
|
uiFlags: state => helpCenterId => {
|
2022-07-27 06:59:11 +00:00
|
|
|
const uiFlags = state.articles.uiFlags.byId[helpCenterId];
|
|
|
|
if (uiFlags) return uiFlags;
|
|
|
|
return { isFetching: false, isUpdating: false, isDeleting: false };
|
|
|
|
},
|
2022-08-02 11:44:10 +00:00
|
|
|
isFetching: state => state.uiFlags.isFetching,
|
2022-07-27 06:59:11 +00:00
|
|
|
articleById: (...getterArguments) => articleId => {
|
|
|
|
const [state] = getterArguments;
|
|
|
|
const article = state.articles.byId[articleId];
|
|
|
|
if (!article) return undefined;
|
|
|
|
return article;
|
|
|
|
},
|
|
|
|
allArticles: (...getterArguments) => {
|
|
|
|
const [state, _getters] = getterArguments;
|
2022-09-01 05:25:59 +00:00
|
|
|
const articles = state.articles.allIds
|
|
|
|
.map(id => {
|
|
|
|
return _getters.articleById(id);
|
|
|
|
})
|
|
|
|
.filter(article => article !== undefined);
|
2022-07-27 06:59:11 +00:00
|
|
|
return articles;
|
|
|
|
},
|
2022-09-02 07:23:18 +00:00
|
|
|
articleStatus: (...getterArguments) => articleId => {
|
|
|
|
const [state] = getterArguments;
|
|
|
|
const article = state.articles.byId[articleId];
|
|
|
|
if (!article) return undefined;
|
|
|
|
return article.status;
|
|
|
|
},
|
2022-08-02 11:44:10 +00:00
|
|
|
getMeta: state => {
|
|
|
|
return state.meta;
|
|
|
|
},
|
2022-07-27 06:59:11 +00:00
|
|
|
};
|