diff --git a/services/api/collections/updateCollection.ts b/services/api/collections/updateCollection.ts index 8b15c7af..11c02394 100644 --- a/services/api/collections/updateCollection.ts +++ b/services/api/collections/updateCollection.ts @@ -1,6 +1,5 @@ import { BaseFetchRequestProps, - FetchRequestProps, fetchRequest, } from '@/services/api/fetchRequest'; @@ -28,10 +27,12 @@ export default async function req({ params, ...props }: BaseFetchRequestProps): Promise { + const { reference, ...restParams } = params!; + return fetchRequest({ ...props, - path: `/collections/${params?.reference}`, + path: `/collections/${reference}`, method: 'put', - params: params, + params: restParams, }); } diff --git a/services/hooks/collections/useUpdateCollection.ts b/services/hooks/collections/useUpdateCollection.ts index be7fbf9f..f2c5d9b6 100644 --- a/services/hooks/collections/useUpdateCollection.ts +++ b/services/hooks/collections/useUpdateCollection.ts @@ -7,10 +7,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import { Params as CollectionRequest } from '@/services/api/collections/createCollection'; import updateCollection from '@/services/api/collections/updateCollection'; -const useUpdateCollection = ({ - reference, - ...params -}: { +const useUpdateCollection = (params: { reference: string; } & CollectionRequest) => { const queryClient = useQueryClient(); @@ -20,10 +17,7 @@ const useUpdateCollection = ({ return useMutation({ mutationFn: () => updateCollection({ - params: { - ...params, - reference: reference, - }, + params, }), mutationKey: ['updateCollection'], onSuccess: async (data) => {