fix(dashboard,js-sdk,types): Remove redundant body for markAsDelivered (#10964)

Resolves CMRC-623
This commit is contained in:
Kasper Fabricius Kristensen
2025-01-20 17:17:48 +00:00
committed by GitHub
parent 45b47bf813
commit d4e042e9ad
5 changed files with 18 additions and 21 deletions
+7
View File
@@ -0,0 +1,7 @@
---
"@medusajs/dashboard": patch
"@medusajs/js-sdk": patch
"@medusajs/types": patch
---
fix(dashboard,js-sdk,types): Remove redundant body for markAsDelivered
@@ -259,12 +259,11 @@ export const useMarkOrderFulfillmentAsDelivered = (
options?: UseMutationOptions< options?: UseMutationOptions<
{ order: HttpTypes.AdminOrder }, { order: HttpTypes.AdminOrder },
FetchError, FetchError,
HttpTypes.AdminMarkOrderFulfillmentAsDelivered void
> >
) => { ) => {
return useMutation({ return useMutation({
mutationFn: (payload: HttpTypes.AdminMarkOrderFulfillmentAsDelivered) => mutationFn: () => sdk.admin.order.markAsDelivered(orderId, fulfillmentId),
sdk.admin.order.markAsDelivered(orderId, fulfillmentId, payload),
onSuccess: (data: any, variables: any, context: any) => { onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ordersQueryKeys.all, queryKey: ordersQueryKeys.all,
@@ -265,17 +265,14 @@ const Fulfillment = ({
}) })
if (res) { if (res) {
await markAsDelivered( await markAsDelivered(undefined, {
{}, onSuccess: () => {
{ toast.success(t("orders.fulfillment.toast.fulfillmentDelivered"))
onSuccess: () => { },
toast.success(t("orders.fulfillment.toast.fulfillmentDelivered")) onError: (e) => {
}, toast.error(e.message)
onError: (e) => { },
toast.error(e.message) })
},
}
)
} }
} }
+1 -5
View File
@@ -1,10 +1,10 @@
import { import {
AdminOrderChangesResponse,
FindParams, FindParams,
HttpTypes, HttpTypes,
PaginatedResponse, PaginatedResponse,
SelectParams, SelectParams,
} from "@medusajs/types" } from "@medusajs/types"
import { AdminOrderChangesResponse } from "@medusajs/types"
import { Client } from "../client" import { Client } from "../client"
import { ClientHeaders } from "../types" import { ClientHeaders } from "../types"
@@ -411,7 +411,6 @@ export class Order {
* *
* @param id - The order's ID. * @param id - The order's ID.
* @param fulfillmentId - The fulfillment's ID. * @param fulfillmentId - The fulfillment's ID.
* @param body - The delivery details.
* @param query - Configure the fields to retrieve in the order. * @param query - Configure the fields to retrieve in the order.
* @param headers - Headers to pass in the request * @param headers - Headers to pass in the request
* @returns The order's details. * @returns The order's details.
@@ -420,7 +419,6 @@ export class Order {
* sdk.admin.order.markAsDelivered( * sdk.admin.order.markAsDelivered(
* "order_123", * "order_123",
* "ful_123", * "ful_123",
* {}
* ) * )
* .then(({ order }) => { * .then(({ order }) => {
* console.log(order) * console.log(order)
@@ -429,7 +427,6 @@ export class Order {
async markAsDelivered( async markAsDelivered(
id: string, id: string,
fulfillmentId: string, fulfillmentId: string,
body: HttpTypes.AdminMarkOrderFulfillmentAsDelivered,
query?: SelectParams, query?: SelectParams,
headers?: ClientHeaders headers?: ClientHeaders
) { ) {
@@ -438,7 +435,6 @@ export class Order {
{ {
method: "POST", method: "POST",
headers, headers,
body,
query, query,
} }
) )
@@ -90,8 +90,6 @@ export interface AdminCancelOrderFulfillment {
no_notification?: boolean no_notification?: boolean
} }
export interface AdminMarkOrderFulfillmentAsDelivered {}
export interface AdminRequestOrderTransfer { export interface AdminRequestOrderTransfer {
customer_id: string customer_id: string
internal_note?: string internal_note?: string