wip
This commit is contained in:
@@ -11,16 +11,22 @@ export const orderApi = baseApi.injectEndpoints({
|
|||||||
query: (orderId) => `/orders/${orderId}`,
|
query: (orderId) => `/orders/${orderId}`,
|
||||||
transformResponse: (response) => response.data || null,
|
transformResponse: (response) => response.data || null,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
placeOrder: builder.mutation({
|
placeOrder: builder.mutation({
|
||||||
query: (orderDetails) => ({
|
query: (orderDetails) => {
|
||||||
url: "/orders",
|
console.log({
|
||||||
method: "POST",
|
watch: orderDetails
|
||||||
body: new URLSearchParams(orderDetails),
|
})
|
||||||
headers: {
|
return {
|
||||||
"Accept": "application/json",
|
url: "/orders",
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
method: "POST",
|
||||||
},
|
body: new URLSearchParams(orderDetails),
|
||||||
}),
|
headers: {
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
transformResponse: (response, meta, arg) => {
|
transformResponse: (response, meta, arg) => {
|
||||||
console.log({response: response})
|
console.log({response: response})
|
||||||
if (response && response.data) {
|
if (response && response.data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user