feat: remove async saving

This commit is contained in:
Shivam Mishra
2025-01-29 15:59:59 +05:30
parent 346d7a0375
commit 2655a8c6b4
2 changed files with 2 additions and 27 deletions
@@ -34,11 +34,10 @@ const portalLink = computed(() => {
);
});
const saveArticle = async ({ ...values }, isAsync = false) => {
const actionToDispatch = isAsync ? 'articles/updateAsync' : 'articles/update';
const saveArticle = async ({ ...values }) => {
isUpdating.value = true;
try {
await store.dispatch(actionToDispatch, {
await store.dispatch('articles/update', {
portalSlug,
articleId: articleSlug,
...values,
@@ -56,10 +55,6 @@ const saveArticle = async ({ ...values }, isAsync = false) => {
}
};
const saveArticleAsync = async ({ ...values }) => {
saveArticle({ ...values }, true);
};
const isCategoryArticles = computed(() => {
return (
route.name === 'portals_categories_articles_index' ||
@@ -106,7 +101,6 @@ onMounted(fetchArticleDetails);
:is-updating="isUpdating"
:is-saved="isSaved"
@save-article="saveArticle"
@save-article-async="saveArticleAsync"
@preview-article="previewArticle"
@go-back="goBackToArticles"
/>
@@ -69,25 +69,6 @@ export const actions = {
}
},
updateAsync: async ({ commit }, { portalSlug, articleId, ...articleObj }) => {
commit(types.UPDATE_ARTICLE_FLAG, {
uiFlags: { isUpdating: true },
articleId,
});
try {
await articlesAPI.updateArticle({ portalSlug, articleId, articleObj });
return articleId;
} catch (error) {
return throwErrorMessage(error);
} finally {
commit(types.UPDATE_ARTICLE_FLAG, {
uiFlags: { isUpdating: false },
articleId,
});
}
},
update: async ({ commit }, { portalSlug, articleId, ...articleObj }) => {
commit(types.UPDATE_ARTICLE_FLAG, {
uiFlags: {