Level 1
axios.post(route('boxBuildSubmitGoodsFlowId'), {goodsFlow: this.goodsFlow})
.then(response => {
if (response.data.to !== null) {
this.boxBuildCenterAudios[response.data.to].play();
console.log(response.data.mix);
this.boxBuildCenterAudios[response.data.to].onended = () => {
if (response.data.mix === true && this.sayMix === true) {
this.mixAudio.play();
}
}
this.$toast.add({
severity: 'success',
summary: 'Success',
detail: "Item added to: " + response.data.centerName,
life: 6000
});
} else {
this.$toast.add({
severity: 'info',
summary: 'Info',
detail: "Don't need",
life: 6000
});
}
You need to do the check inside onended function