From ca74e3dae6a76d0ff60cf282cfb381c65cf353d8 Mon Sep 17 00:00:00 2001 From: Lucas Zerbib Date: Sun, 28 Apr 2024 16:46:12 +0200 Subject: [PATCH] Add params in useDirectusItems.ts (updateItem&createItems) --- src/runtime/composables/useDirectusItems.ts | 6 ++++-- src/runtime/types/index.d.ts | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/runtime/composables/useDirectusItems.ts b/src/runtime/composables/useDirectusItems.ts index 64489fbe..51942691 100644 --- a/src/runtime/composables/useDirectusItems.ts +++ b/src/runtime/composables/useDirectusItems.ts @@ -67,7 +67,8 @@ export const useDirectusItems = () => { const createItems = async (data: DirectusItemCreation): Promise => { const items = await directus<{ data: T[] }>(`/items/${data.collection}`, { method: 'POST', - body: data.items + body: data.items, + params: data.params }) return items.data } @@ -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 diff --git a/src/runtime/types/index.d.ts b/src/runtime/types/index.d.ts index 6d75c647..4ec5046c 100644 --- a/src/runtime/types/index.d.ts +++ b/src/runtime/types/index.d.ts @@ -74,12 +74,14 @@ export interface DirectusItemMetaRequest extends DirectusItemRequest { export interface DirectusItemCreation { collection: string; items: Array | Object; + params?: DirectusQueryParams; } export interface DirectusItemUpdate { collection: string; id: string; item: Object; + params?: DirectusQueryParams; } export interface DirectusItemDeletion { collection: string;