@@ -29,15 +29,10 @@ export const useStrapi = <T>(): StrapiV5Client<T> => {
2929 *
3030 * @param {string } contentType - Content type's name pluralized
3131 * @param {string } documentId - ID of entry
32- * @param {Strapi5RequestParams<T> } [params] - Query parameters
32+ * @param {Omit< Strapi5RequestParams<T>, 'filter' > } [params] - Query parameters
3333 * @returns Promise<T>
3434 */
35- const findOne = < T > ( contentType : string , documentId ?: string | Strapi5RequestParams < T > , params ?: Strapi5RequestParams < T > , fetchOptions ?: FetchOptions ) : Promise < Strapi5ResponseSingle < T > > => {
36- if ( typeof documentId === 'object' ) {
37- params = documentId
38- documentId = undefined
39- }
40-
35+ const findOne = < T > ( contentType : string , documentId : string , params ?: Omit < Strapi5RequestParams < T > , 'filter' > , fetchOptions ?: FetchOptions ) : Promise < Strapi5ResponseSingle < T > > => {
4136 const path = [ contentType , documentId ] . filter ( Boolean ) . join ( '/' )
4237
4338 return client ( path , { method : 'GET' , params, ...fetchOptions } )
@@ -48,10 +43,10 @@ export const useStrapi = <T>(): StrapiV5Client<T> => {
4843 *
4944 * @param {string } contentType - Content type's name pluralized
5045 * @param {Record<string, any> } data - Form data
51- * @param {Strapi5RequestParams<T> } [params] - Query parameters
46+ * @param {Omit< Strapi5RequestParams<T>, 'filter' > } [params] - Query parameters
5247 * @returns Promise<T>
5348 */
54- const create = < T > ( contentType : string , data : Partial < T > , params : Strapi5RequestParams < T > = { } ) : Promise < Strapi5ResponseSingle < T > > => {
49+ const create = < T > ( contentType : string , data : Partial < T > , params : Omit < Strapi5RequestParams < T > , 'filter' > = { } ) : Promise < Strapi5ResponseSingle < T > > => {
5550 return client ( `/${ contentType } ` , { method : 'POST' , body : { data } , params } )
5651 }
5752
@@ -61,10 +56,10 @@ export const useStrapi = <T>(): StrapiV5Client<T> => {
6156 * @param {string } contentType - Content type's name pluralized
6257 * @param {string } documentId - ID of entry to be updated
6358 * @param {Record<string, any> } data - Form data
64- * @param {Strapi5RequestParams<T> } [params] - Query parameters
59+ * @param {Omit< Strapi5RequestParams<T>, 'filter' > } [params] - Query parameters
6560 * @returns Promise<T>
6661 */
67- const update = < T > ( contentType : string , documentId : string | Partial < T > , data ?: Partial < T > , params : Strapi5RequestParams < T > = { } ) : Promise < Strapi5ResponseSingle < T > > => {
62+ const update = < T > ( contentType : string , documentId : string | Partial < T > , data ?: Partial < T > , params : Omit < Strapi5RequestParams < T > , 'filter' > = { } ) : Promise < Strapi5ResponseSingle < T > > => {
6863 if ( typeof documentId === 'object' ) {
6964 data = documentId
7065 documentId = undefined
0 commit comments