Ваше действие AddDelivery
должно возвращать обещание. Затем используйте, как показано ниже
const addDelivery = async function() {
try {
return this.$store.dispatch('AddDelivery', this.form)
} catch (error) {
return
}
}
function submit() {
addDelivery().then(() => {
console.log('Clear data here')
this.form.firstName
= this.form.lastName
= this.form.address1
= this.form.address2
= this.form.postcode
= this.form.city
= this.form.phone
='';
})
}
или
function submit() {
this.$store.dispatch('AddDelivery', this.form)
.then(() => {
console.log('Clear data here')
this.form.firstName
= this.form.lastName
= this.form.address1
= this.form.address2
= this.form.postcode
= this.form.city
= this.form.phone
='';
})
}