Recently started using VueJS. I have created the code below to fetch data from the Controller with axios:
SubmitForm: function () {
axios({
method: 'post',
url: '/Home/SubmitedForm',
data: { "Fields": this.$data }
}).then(res => {
alert('Form submitted successfully ');
window.close();
}).catch(err => {
if (err.response.status == 409) {
alert(`Data already exists. Details: ${err}`)
}
else {
alert(`There was an issue submitting your form. Details: ${err}`)
}
});
When the Controller's SubmittedForm method returns a status of 409, I want to display a specific alert, otherwise, a generic one. However, despite getting a 409 status, it only displays the generic alert message instead of the expected specific one, as per the reference page provided in the code. I suspect there might be something I'm missing or misunderstanding. Would appreciate any help in identifying what I could be doing wrong. The functionality works fine on localhost but after deploying to azurewebsites, it reverts back to showing the generic error message.