fix(dashboard, medusa): mark shipped flow (#8065)
* fix: mark shipped routing * fix: naming
This commit is contained in:
@@ -43,10 +43,10 @@ export const useCancelFulfillment = (
|
||||
})
|
||||
}
|
||||
|
||||
export const useCreateShipment = (
|
||||
export const useCreateFulfillmentShipment = (
|
||||
fulfillmentId: string,
|
||||
options?: UseMutationOptions<
|
||||
{ order: HttpTypes.AdminOrder },
|
||||
{ fulfillment: HttpTypes.AdminFulfillment },
|
||||
Error,
|
||||
HttpTypes.AdminCreateFulfillmentShipment
|
||||
>
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { sdk } from "../../lib/client"
|
||||
import { AdminCreateOrderShipment, HttpTypes } from "@medusajs/types"
|
||||
|
||||
const ORDERS_QUERY_KEY = "orders" as const
|
||||
export const ordersQueryKeys = queryKeysFactory(ORDERS_QUERY_KEY)
|
||||
@@ -81,6 +82,28 @@ export const useCancelOrderFulfillment = (
|
||||
})
|
||||
}
|
||||
|
||||
export const useCreateOrderShipment = (
|
||||
orderId: string,
|
||||
fulfillmentId: string,
|
||||
options?: UseMutationOptions<
|
||||
{ order: HttpTypes.AdminOrder },
|
||||
Error,
|
||||
HttpTypes.AdminCreateOrderShipment
|
||||
>
|
||||
) => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: HttpTypes.AdminCreateOrderShipment) =>
|
||||
sdk.admin.order.createShipment(orderId, fulfillmentId, payload),
|
||||
onSuccess: (data: any, variables: any, context: any) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ordersQueryKeys.details(),
|
||||
})
|
||||
options?.onSuccess?.(data, variables, context)
|
||||
},
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
export const useCancelOrder = (
|
||||
orderId: string,
|
||||
options?: UseMutationOptions<any, Error, any>
|
||||
|
||||
Reference in New Issue
Block a user