feat: scope articles by brand
This commit is contained in:
@@ -20,10 +20,12 @@ import { buildArticleClipboardContent, resolveArticleActionState } from '@/lib/a
|
||||
import { useArticleRegenerateAction } from '@/lib/article-regenerate-action'
|
||||
import { getGenerateStatusMeta, getPublishStatusMeta, hasActiveGenerationStatus } from '@/lib/display'
|
||||
import { formatError } from '@/lib/errors'
|
||||
import { useCompanyStore } from '@/stores/company'
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
const router = useRouter()
|
||||
const { t } = useI18n()
|
||||
const companyStore = useCompanyStore()
|
||||
|
||||
const publishModalOpen = ref(false)
|
||||
const selectedPublishArticleId = ref<number | null>(null)
|
||||
@@ -80,7 +82,8 @@ const articleParams = computed<ArticleListParams>(() => {
|
||||
})
|
||||
|
||||
const articleListQuery = useQuery({
|
||||
queryKey: computed(() => ['articles', 'list', articleParams.value]),
|
||||
queryKey: computed(() => ['articles', 'list', companyStore.currentBrandId, articleParams.value]),
|
||||
enabled: computed(() => Boolean(companyStore.currentBrandId)),
|
||||
queryFn: () => articlesApi.list(articleParams.value),
|
||||
})
|
||||
|
||||
@@ -205,6 +208,10 @@ function resetFilters(): void {
|
||||
}
|
||||
|
||||
function openCreate(): void {
|
||||
if (!companyStore.currentBrandId) {
|
||||
message.warning(t('templates.wizard.messages.selectBrandBeforeQuestion'))
|
||||
return
|
||||
}
|
||||
void router.push({ name: 'article-imitation-create' })
|
||||
}
|
||||
|
||||
@@ -278,7 +285,7 @@ async function copyArticle(articleId: number): Promise<void> {
|
||||
<p>{{ t('route.imitation.description') }}</p>
|
||||
</div>
|
||||
<div class="imitation-view__header-actions">
|
||||
<a-button type="primary" @click="openCreate">
|
||||
<a-button type="primary" :disabled="!companyStore.currentBrandId" @click="openCreate">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
{{ t('imitation.actions.create') }}
|
||||
</a-button>
|
||||
|
||||
Reference in New Issue
Block a user