Add multi-workspace selector scope
This commit is contained in:
@@ -20,7 +20,7 @@ export const useContentItemsStore = defineStore('content-items', () => {
|
||||
);
|
||||
|
||||
async function fetchContentItems(filters = {}) {
|
||||
if (!authStore.isAuthenticated || !workspaceStore.activeWorkspaceId) {
|
||||
if (!authStore.isAuthenticated) {
|
||||
items.value = [];
|
||||
error.value = null;
|
||||
return;
|
||||
@@ -32,13 +32,15 @@ export const useContentItemsStore = defineStore('content-items', () => {
|
||||
try {
|
||||
const response = await client.get('/api/content-items', {
|
||||
params: {
|
||||
workspaceId: workspaceStore.activeWorkspaceId,
|
||||
workspaceId: workspaceStore.activeWorkspaceId ?? undefined,
|
||||
clientId: filters.clientId,
|
||||
campaignId: filters.campaignId,
|
||||
},
|
||||
});
|
||||
|
||||
items.value = response.data ?? [];
|
||||
items.value = (response.data ?? []).filter(item =>
|
||||
workspaceStore.isWorkspaceVisible(item.workspaceId)
|
||||
);
|
||||
} catch (fetchError) {
|
||||
console.error('Failed to fetch content items:', fetchError);
|
||||
items.value = [];
|
||||
@@ -86,9 +88,9 @@ export const useContentItemsStore = defineStore('content-items', () => {
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [authStore.isAuthenticated, workspaceStore.activeWorkspaceId],
|
||||
async ([isAuthenticated, workspaceId]) => {
|
||||
if (!isAuthenticated || !workspaceId) {
|
||||
() => [authStore.isAuthenticated, workspaceStore.workspaceScopeKey],
|
||||
async ([isAuthenticated]) => {
|
||||
if (!isAuthenticated) {
|
||||
items.value = [];
|
||||
error.value = null;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user