Skip to content

Commit

Permalink
fix: stringify "deep" key on get item by id
Browse files Browse the repository at this point in the history
When we query a single item, we can add a deep parameter to embed many-to-many relations. So, this param should be stringifyied. Applying the same operation to filter is more coherent, regarding the other functions.
  • Loading branch information
Nainterceptor authored Jun 8, 2022
1 parent 2fe048a commit 1ca45b6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/runtime/composables/useDirectusItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export const useDirectusItems = () => {
};

const getItemById = async <T>(data: DirectusItemRequest): Promise<T> => {
if (data.params?.filter) {
(data.params.filter as unknown) = JSON.stringify(data.params.filter);
}
if (data.params?.deep) {
(data.params.deep as unknown) = JSON.stringify(data.params.deep);
}
const items = await directus<{ data: T[] }>(
`/items/${data.collection}/${data.id}`,
{
Expand Down

0 comments on commit 1ca45b6

Please sign in to comment.