feat: scope articles by brand
This commit is contained in:
@@ -8,6 +8,7 @@ import { useI18n } from 'vue-i18n'
|
||||
import { articlesApi, mediaApi } from '@/lib/api'
|
||||
import { getPublishStatusMeta } from '@/lib/display'
|
||||
import { getPublishPlatformMeta, normalizePublishPlatformId } from '@/lib/publish-platforms'
|
||||
import { useCompanyStore } from '@/stores/company'
|
||||
|
||||
interface PublishPlatformEntry {
|
||||
key: string
|
||||
@@ -42,6 +43,7 @@ const props = withDefaults(
|
||||
)
|
||||
|
||||
const { t } = useI18n()
|
||||
const companyStore = useCompanyStore()
|
||||
const popoverOpen = ref(false)
|
||||
const shouldLoadRecords = computed(() => Boolean(props.articleId) && props.status !== 'unpublished')
|
||||
const shouldLoadPlatforms = computed(() => props.showPlatforms && shouldLoadRecords.value)
|
||||
@@ -54,8 +56,13 @@ const platformsQuery = useQuery({
|
||||
})
|
||||
|
||||
const publishRecordsQuery = useQuery({
|
||||
queryKey: computed(() => ['articles', 'publish-records', props.articleId]),
|
||||
enabled: shouldLoadRecords,
|
||||
queryKey: computed(() => [
|
||||
'articles',
|
||||
'publish-records',
|
||||
companyStore.currentBrandId,
|
||||
props.articleId,
|
||||
]),
|
||||
enabled: computed(() => shouldLoadRecords.value && Boolean(companyStore.currentBrandId)),
|
||||
queryFn: () => articlesApi.publishRecords(props.articleId as number),
|
||||
staleTime: 30 * 1000,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user