Skip to content

Commit

Permalink
πŸ› Fix mark complete not reactive
Browse files Browse the repository at this point in the history
  • Loading branch information
nwingt authored and williamchong committed Dec 21, 2023
1 parent ad97495 commit 9fd57b9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pages/nft-book-store/status/[classId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,14 @@ async function hardSetStatusToCompleted (purchase: any) {
return
}
const orderData = ordersData.value?.orders?.find((p: any) => p.id === purchase.id)
if (!orderData) {
throw new Error('ORDER_NOT_FOUND')
}
const previousStatus = orderData.status
orderData.status = 'completed'
const { error: fetchError } = await useFetch(`${LIKE_CO_API}/likernft/book/purchase/${classId.value}/sent/${purchase.id}`,
{
method: 'POST',
Expand All @@ -952,10 +960,12 @@ async function hardSetStatusToCompleted (purchase: any) {
authorization: `Bearer ${token.value}`
}
})
if (fetchError.value) {
orderData.status = previousStatus
throw fetchError.value
}
purchase.status = 'completed'
classListingInfo.value.pendingNFTCount -= 1
}
Expand Down

0 comments on commit 9fd57b9

Please sign in to comment.