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:
@@ -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 = (
|
export const useAddExchangeInboundItems = (
|
||||||
id: string,
|
id: string,
|
||||||
orderId: string,
|
orderId: string,
|
||||||
|
|||||||
@@ -73,72 +73,6 @@ export class Exchange {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async delete(
|
|
||||||
id: string,
|
|
||||||
query?: HttpTypes.SelectParams,
|
|
||||||
headers?: ClientHeaders
|
|
||||||
) {
|
|
||||||
return await this.client.fetch<HttpTypes.AdminExchangeDeleteResponse>(
|
|
||||||
`/admin/exchanges/${id}`,
|
|
||||||
{
|
|
||||||
method: "DELETE",
|
|
||||||
headers,
|
|
||||||
query,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
async addItems(
|
|
||||||
id: string,
|
|
||||||
body: HttpTypes.AdminAddExchangeItems,
|
|
||||||
query?: HttpTypes.SelectParams,
|
|
||||||
headers?: ClientHeaders
|
|
||||||
) {
|
|
||||||
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
|
|
||||||
`/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<HttpTypes.AdminExchangeResponse>(
|
|
||||||
`/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<HttpTypes.AdminReturnResponse>(
|
|
||||||
`/admin/exchanges/${id}/exchange-items/${actionId}`,
|
|
||||||
{
|
|
||||||
method: "DELETE",
|
|
||||||
headers,
|
|
||||||
query,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
async addInboundItems(
|
async addInboundItems(
|
||||||
id: string,
|
id: string,
|
||||||
body: HttpTypes.AdminAddExchangeInboundItems,
|
body: HttpTypes.AdminAddExchangeInboundItems,
|
||||||
|
|||||||
@@ -44,9 +44,6 @@ export interface AdminCreateExchange {
|
|||||||
metadata?: Record<string, unknown> | null
|
metadata?: Record<string, unknown> | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminAddExchangeItems extends AdminExchangeAddItems {}
|
|
||||||
export interface AdminUpdateExchangeItem extends AdminExchangeUpdateItem {}
|
|
||||||
|
|
||||||
export interface AdminAddExchangeInboundItems extends AdminExchangeAddItems {}
|
export interface AdminAddExchangeInboundItems extends AdminExchangeAddItems {}
|
||||||
export interface AdminUpdateExchangeInboundItem
|
export interface AdminUpdateExchangeInboundItem
|
||||||
extends AdminExchangeUpdateItem {}
|
extends AdminExchangeUpdateItem {}
|
||||||
|
|||||||
Reference in New Issue
Block a user