fix(dashboard,js-sdk): remove methods / hooks to non existing exchange routes (#9697)

Remove the following exchange methods (and hooks from dashboard) which point to routes that don't exist:

- `delete`
- `addItems`
- `updateItem`
- `removeItem`
This commit is contained in:
Shahed Nasser
2024-10-21 17:00:30 +03:00
committed by GitHub
parent 16e44688ba
commit a0668adefa
3 changed files with 0 additions and 170 deletions

View File

@@ -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,