Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/screens/CheckoutScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,20 @@ const CheckoutScreen = () => {
throw new Error(err);
});
setOrderStatusUI(false);
if (response.status !== 200) {
uiToast
? uiToast.show({
type: 'error',
position: 'bottom',
text1: 'Error: Could not place order.',
})
: null;
if (response.status === 400) {
const errorData = await response.json();
const outOfStockItems = errorData.out_of_stock.join(', ');
uiToast?.show({
type: 'error',
position: 'bottom',
text1: `Error: The following items are out of stock: ${outOfStockItems}.`,
});
} else if (response.status !== 200) {
uiToast?.show({
type: 'error',
position: 'bottom',
text1: 'Error: Could not place order.',
});

Sentry.captureException(
new Error(
Expand Down
Loading