mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
Re-use getEndpoint utility function (#16700)
* re-use getEndpoint util * rename endpoint var to route in calendar layout * move loading below early return statements
This commit is contained in:
@@ -2,7 +2,7 @@ import { useApi } from './use-system';
|
||||
import axios from 'axios';
|
||||
import { useCollection } from './use-collection';
|
||||
import { Item, Query } from '../types';
|
||||
import { moveInArray } from '../utils';
|
||||
import { getEndpoint, moveInArray } from '../utils';
|
||||
import { isEqual, throttle } from 'lodash';
|
||||
import { computed, ComputedRef, ref, Ref, watch, WritableComputedRef, unref } from 'vue';
|
||||
|
||||
@@ -42,9 +42,7 @@ export function useItems(collection: Ref<string | null>, query: ComputedQuery):
|
||||
|
||||
const endpoint = computed(() => {
|
||||
if (!collection.value) return null;
|
||||
return collection.value.startsWith('directus_')
|
||||
? `/${collection.value.substring(9)}`
|
||||
: `/items/${collection.value}`;
|
||||
return getEndpoint(collection.value);
|
||||
});
|
||||
|
||||
const items = ref<Item[]>([]);
|
||||
|
||||
Reference in New Issue
Block a user