feat(order): order process enchancements

This commit is contained in:
Nikita Kiselev
2025-08-01 09:49:54 +03:00
parent c057f4be76
commit 85101b9881
16 changed files with 781 additions and 166 deletions

View File

@@ -25,16 +25,18 @@ export const useCheckoutStore = defineStore('checkout', {
actions: {
async makeOrder() {
await storeOrder(this.customer)
.catch(error => {
if (error.response?.status === 422) {
this.validationErrors = error.response._data.data;
} else {
console.error('Unexpected error', error);
}
});
try {
await storeOrder(this.customer);
await useCartStore().getProducts();
} catch (error) {
if (error.response?.status === 422) {
this.validationErrors = error.response._data.data;
} else {
console.error('Server error', error);
}
await useCartStore().getProducts();
throw error;
}
},
clearError(field) {