Merge branch 'develop' into feat/contacts-redesign

This commit is contained in:
Sivin Varghese
2024-11-22 09:28:44 +05:30
committed by GitHub
3 changed files with 51 additions and 9 deletions
@@ -34,10 +34,11 @@ const portalLink = computed(() => {
);
});
const saveArticle = async ({ ...values }) => {
const saveArticle = async ({ ...values }, isAsync = false) => {
const actionToDispatch = isAsync ? 'articles/updateAsync' : 'articles/update';
isUpdating.value = true;
try {
await store.dispatch('articles/update', {
await store.dispatch(actionToDispatch, {
portalSlug,
articleId: articleSlug,
...values,
@@ -55,6 +56,10 @@ const saveArticle = async ({ ...values }) => {
}
};
const saveArticleAsync = async ({ ...values }) => {
saveArticle({ ...values }, true);
};
const isCategoryArticles = computed(() => {
return (
route.name === 'portals_categories_articles_index' ||
@@ -92,9 +97,7 @@ const previewArticle = () => {
});
};
onMounted(() => {
fetchArticleDetails();
});
onMounted(fetchArticleDetails);
</script>
<template>
@@ -103,6 +106,7 @@ onMounted(() => {
:is-updating="isUpdating"
:is-saved="isSaved"
@save-article="saveArticle"
@save-article-async="saveArticleAsync"
@preview-article="previewArticle"
@go-back="goBackToArticles"
/>