mirror of
https://github.com/directus/directus.git
synced 2026-01-24 05:48:03 -05:00
Don't try fetching items if none are set
This commit is contained in:
@@ -239,14 +239,21 @@ export default defineComponent({
|
||||
? `/${relatedCollection.value.collection.substring(9)}`
|
||||
: `/items/${relatedCollection.value.collection}`;
|
||||
|
||||
const response = await api.get(endpoint, {
|
||||
params: {
|
||||
fields: fields,
|
||||
[`filter[${pkField}][_in]`]: getPrimaryKeys().join(','),
|
||||
},
|
||||
});
|
||||
const primaryKeys = getPrimaryKeys();
|
||||
|
||||
let existingItems: any[] = [];
|
||||
|
||||
if (primaryKeys && primaryKeys.length > 0) {
|
||||
const response = await api.get(endpoint, {
|
||||
params: {
|
||||
fields: fields,
|
||||
[`filter[${pkField}][_in]`]: getPrimaryKeys().join(','),
|
||||
},
|
||||
});
|
||||
|
||||
existingItems = response.data.data;
|
||||
}
|
||||
|
||||
const existingItems = (response.data.data as Record<string, any>[]) || [];
|
||||
const updatedItems = getUpdatedItems();
|
||||
const newItems = getNewItems();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user