feat(medusa, medusa-js, medusa-react): Implement store complete order… (#2275)
**What** Allow a customer to complete a requested order edit. **Test** - Unit tests complete flow - Unit tests medusa react - Integration tests of order edit completion FIXES CORE-501
This commit is contained in:
@@ -2,8 +2,8 @@ import { useMutation, UseMutationOptions, useQueryClient } from "react-query"
|
||||
import { Response } from "@medusajs/medusa-js"
|
||||
|
||||
import {
|
||||
StoreOrderEditsRes,
|
||||
StorePostOrderEditsOrderEditDecline,
|
||||
StoreOrderEditsRes
|
||||
} from "@medusajs/medusa"
|
||||
|
||||
import { buildOptions } from "../../utils/buildOptions"
|
||||
@@ -31,3 +31,20 @@ export const useDeclineOrderEdit = (
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
export const useCompleteOrderEdit = (
|
||||
id: string,
|
||||
options?: UseMutationOptions<Response<StoreOrderEditsRes>, Error>
|
||||
) => {
|
||||
const { client } = useMedusa()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation(
|
||||
() => client.orderEdits.complete(id),
|
||||
buildOptions(
|
||||
queryClient,
|
||||
[orderEditQueryKeys.lists(), orderEditQueryKeys.detail(id)],
|
||||
options
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user