mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 07:26:59 +00:00
fix: Clean order
This commit is contained in:
parent
0f5cdf99fb
commit
dbecda64c4
@ -18,9 +18,9 @@ export const handler: SWRHook<any> = {
|
|||||||
const clOrder = await Order.withCredentials(credentials)
|
const clOrder = await Order.withCredentials(credentials)
|
||||||
.includes('lineItems')
|
.includes('lineItems')
|
||||||
.find(id, { rawResponse: true })
|
.find(id, { rawResponse: true })
|
||||||
const orderStatus = clOrder.status
|
|
||||||
if (['pending', 'draft'].includes(orderStatus)) {
|
|
||||||
const attributes = clOrder.data.attributes
|
const attributes = clOrder.data.attributes
|
||||||
|
const orderStatus = attributes.status
|
||||||
|
if (['pending', 'draft'].includes(orderStatus)) {
|
||||||
const lineItems = clOrder?.included
|
const lineItems = clOrder?.included
|
||||||
? normalizeLineItems(clOrder?.included)
|
? normalizeLineItems(clOrder?.included)
|
||||||
: []
|
: []
|
||||||
@ -34,7 +34,7 @@ export const handler: SWRHook<any> = {
|
|||||||
subtotalPrice: attributes.subtotal_amount_float,
|
subtotalPrice: attributes.subtotal_amount_float,
|
||||||
totalPrice: attributes.total_amount_float,
|
totalPrice: attributes.total_amount_float,
|
||||||
}
|
}
|
||||||
} else {
|
} else if (id) {
|
||||||
localStorage.removeItem('CL_ORDER_ID')
|
localStorage.removeItem('CL_ORDER_ID')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user