✅ – _mercury – 21-58 Dec 25
what could by the reason that this func sends 2 reqs ?
async saveProduct(cartoon) {
this.order.err = null;
this.order.success = null;
const response = await fetch(
'/orders/{{ $order->id }}/add-product-to/' + cartoon.number, {
method: 'POST',
headers: {
'X-CSRF-Token': document.querySelector('input[name=_token]')
.value
},
body: JSON.stringify(this.order)
});
if (response.ok) {
this.order.success = true;
this.order.err = null;
const product = await response.json();
const activeCartoon = this.order.cartoons.find(c => c.number == cartoon
.number);
// console.log(product);
activeCartoon.products.push({
number: product.packed_by_mfg_serial ? product.mfg_serial :
product.serial,
name: product.product
});
}async saveProduct(cartoon) {
this.order.err = null;
this.order.success = null;
const response = await fetch(
'/orders/{{ $order->id }}/add-product-to/' + cartoon.number, {
method: 'POST',
headers: {
'X-CSRF-Token': document.querySelector('input[name=_token]')
.value
},
body: JSON.stringify(this.order)
});
if (response.ok) {
this.order.success = true;
this.order.err = null;
const product = await response.json();
const activeCartoon = this.order.cartoons.find(c => c.number == cartoon
.number);
// console.log(product);
activeCartoon.products.push({
number: product.packed_by_mfg_serial ? product.mfg_serial :
product.serial,
name: product.product
});
}