Skip to content

Commit

Permalink
fix: order id does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlLiu2023 committed Apr 3, 2023
1 parent be6df10 commit 62404e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/storefront/src/pages/orderDetail/OrderDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const OrderDetail = () => {
const localtion = useLocation()

const [isMobile] = useMobile()
const [preOrderId, setPreOrderId] = useState('')
const [orderId, setOrderId] = useState('')
const [isRequestLoading, setIsRequestLoading] = useState(false)

Expand Down Expand Up @@ -125,6 +126,13 @@ const OrderDetail = () => {
type: 'all',
payload: data,
})
setPreOrderId(orderId)
}
} catch (err) {
if (err === 'order does not exist') {
setTimeout(() => {
window.location.hash = `/orderDetail/${preOrderId}`
}, 1000)
}
} finally {
setIsRequestLoading(false)
Expand Down

0 comments on commit 62404e1

Please sign in to comment.