Skip to content

Commit

Permalink
Merge pull request #258 from docloulou/main
Browse files Browse the repository at this point in the history
  • Loading branch information
Intevel authored Apr 28, 2024
2 parents d79caf3 + ca74e3d commit d1d6915
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/runtime/composables/useDirectusItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export const useDirectusItems = () => {
const createItems = async <T>(data: DirectusItemCreation): Promise<T[]> => {
const items = await directus<{ data: T[] }>(`/items/${data.collection}`, {
method: 'POST',
body: data.items
body: data.items,
params: data.params
})
return items.data
}
Expand All @@ -84,7 +85,8 @@ export const useDirectusItems = () => {
`/items/${data.collection}/${data.id}`,
{
method: 'PATCH',
body: data.item
body: data.item,
params: data.params
}
)
return item?.data
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ export interface DirectusItemMetaRequest extends DirectusItemRequest {
export interface DirectusItemCreation {
collection: string;
items: Array<Object> | Object;
params?: DirectusQueryParams;
}

export interface DirectusItemUpdate {
collection: string;
id: string;
item: Object;
params?: DirectusQueryParams;
}
export interface DirectusItemDeletion {
collection: string;
Expand Down

0 comments on commit d1d6915

Please sign in to comment.