Skip to content

Commit

Permalink
fix(chore)!: getItemById return an array of items
Browse files Browse the repository at this point in the history
Fixes #29
  • Loading branch information
Intevel committed May 6, 2022
1 parent 291b9e7 commit 2ef29ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/composables/useDirectusItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ export const useDirectusItems = () => {
return items.data;
};

const getItemById = async <T>(data: DirectusItemRequest): Promise<T[]> => {
const getItemById = async <T>(data: DirectusItemRequest): Promise<T> => {
const items = await directus<{ data: T[] }>(
`/items/${data.collection}/${data.id}`,
{
method: "GET",
params: data.params,
}
);
return items.data;
return items.data[0];
};

const createItems = async <T>(data: DirectusItemCreation): Promise<T[]> => {
Expand Down

0 comments on commit 2ef29ce

Please sign in to comment.