diff --git a/packages/admin/dashboard/src/hooks/api/exchanges.tsx b/packages/admin/dashboard/src/hooks/api/exchanges.tsx index 031c46c28025d..f28600f510703 100644 --- a/packages/admin/dashboard/src/hooks/api/exchanges.tsx +++ b/packages/admin/dashboard/src/hooks/api/exchanges.tsx @@ -118,107 +118,6 @@ export const useCancelExchange = ( }) } -export const useDeleteExchange = ( - id: string, - orderId: string, - options?: UseMutationOptions< - HttpTypes.AdminExchangeDeleteResponse, - FetchError - > -) => { - return useMutation({ - mutationFn: () => sdk.admin.exchange.delete(id), - onSuccess: (data: any, variables: any, context: any) => { - queryClient.invalidateQueries({ - queryKey: ordersQueryKeys.details(), - }) - - queryClient.invalidateQueries({ - queryKey: ordersQueryKeys.preview(orderId), - }) - - queryClient.invalidateQueries({ - queryKey: exchangesQueryKeys.details(), - }) - queryClient.invalidateQueries({ - queryKey: exchangesQueryKeys.lists(), - }) - options?.onSuccess?.(data, variables, context) - }, - ...options, - }) -} - -export const useAddExchangeItems = ( - id: string, - orderId: string, - options?: UseMutationOptions< - HttpTypes.AdminExchangeResponse, - FetchError, - HttpTypes.AdminAddExchangeItems - > -) => { - return useMutation({ - mutationFn: (payload: HttpTypes.AdminAddExchangeItems) => - sdk.admin.exchange.addItems(id, payload), - onSuccess: (data: any, variables: any, context: any) => { - queryClient.invalidateQueries({ - queryKey: ordersQueryKeys.preview(orderId), - }) - options?.onSuccess?.(data, variables, context) - }, - ...options, - }) -} - -export const useUpdateExchangeItems = ( - id: string, - orderId: string, - options?: UseMutationOptions< - HttpTypes.AdminExchangeResponse, - FetchError, - HttpTypes.AdminUpdateExchangeItem & { actionId: string } - > -) => { - return useMutation({ - mutationFn: ({ - actionId, - ...payload - }: HttpTypes.AdminUpdateExchangeItem & { actionId: string }) => { - return sdk.admin.exchange.updateItem(id, actionId, payload) - }, - onSuccess: (data: any, variables: any, context: any) => { - queryClient.invalidateQueries({ - queryKey: ordersQueryKeys.preview(orderId), - }) - options?.onSuccess?.(data, variables, context) - }, - ...options, - }) -} - -export const useRemoveExchangeItem = ( - id: string, - orderId: string, - options?: UseMutationOptions< - HttpTypes.AdminReturnResponse, - FetchError, - string - > -) => { - return useMutation({ - mutationFn: (actionId: string) => - sdk.admin.return.removeReturnItem(id, actionId), - onSuccess: (data: any, variables: any, context: any) => { - queryClient.invalidateQueries({ - queryKey: ordersQueryKeys.preview(orderId), - }) - options?.onSuccess?.(data, variables, context) - }, - ...options, - }) -} - export const useAddExchangeInboundItems = ( id: string, orderId: string, diff --git a/packages/core/js-sdk/src/admin/exchange.ts b/packages/core/js-sdk/src/admin/exchange.ts index 0b73c9b965a8d..151f720062e3a 100644 --- a/packages/core/js-sdk/src/admin/exchange.ts +++ b/packages/core/js-sdk/src/admin/exchange.ts @@ -73,72 +73,6 @@ export class Exchange { ) } - async delete( - id: string, - query?: HttpTypes.SelectParams, - headers?: ClientHeaders - ) { - return await this.client.fetch( - `/admin/exchanges/${id}`, - { - method: "DELETE", - headers, - query, - } - ) - } - - async addItems( - id: string, - body: HttpTypes.AdminAddExchangeItems, - query?: HttpTypes.SelectParams, - headers?: ClientHeaders - ) { - return await this.client.fetch( - `/admin/exchanges/${id}/exchange-items`, - { - method: "POST", - headers, - body, - query, - } - ) - } - - async updateItem( - id: string, - actionId: string, - body: HttpTypes.AdminUpdateExchangeItem, - query?: HttpTypes.SelectParams, - headers?: ClientHeaders - ) { - return await this.client.fetch( - `/admin/exchanges/${id}/exchange-items/${actionId}`, - { - method: "POST", - headers, - body, - query, - } - ) - } - - async removeItem( - id: string, - actionId: string, - query?: HttpTypes.SelectParams, - headers?: ClientHeaders - ) { - return await this.client.fetch( - `/admin/exchanges/${id}/exchange-items/${actionId}`, - { - method: "DELETE", - headers, - query, - } - ) - } - async addInboundItems( id: string, body: HttpTypes.AdminAddExchangeInboundItems, diff --git a/packages/core/types/src/http/exchange/admin/payloads.ts b/packages/core/types/src/http/exchange/admin/payloads.ts index d1fb326be62ca..c28511586ab12 100644 --- a/packages/core/types/src/http/exchange/admin/payloads.ts +++ b/packages/core/types/src/http/exchange/admin/payloads.ts @@ -44,9 +44,6 @@ export interface AdminCreateExchange { metadata?: Record | null } -export interface AdminAddExchangeItems extends AdminExchangeAddItems {} -export interface AdminUpdateExchangeItem extends AdminExchangeUpdateItem {} - export interface AdminAddExchangeInboundItems extends AdminExchangeAddItems {} export interface AdminUpdateExchangeInboundItem extends AdminExchangeUpdateItem {}