Skip to content

Commit

Permalink
refactor: simplify AI lead creation response handling and improve cod…
Browse files Browse the repository at this point in the history
…e readability
  • Loading branch information
amit-webkul committed Jan 31, 2025
1 parent 4982487 commit dadf3b0
Showing 1 changed file with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,28 +107,26 @@ class="primary-button justify-center"
userForm.append('_method', 'post');
this.$axios.post("{{ route('admin.leads.create_by_ai') }}", userForm, {
headers: {
'Content-Type': 'multipart/form-data',
}
})
.then (response => {
this.isLoading = false;
headers: {
'Content-Type': 'multipart/form-data',
}
})
.then (response => {
this.isLoading = false;
this.$emitter.emit('add-flash', { type: 'success', message: response.data.message });
this.$emitter.emit('add-flash', { type: 'success', message: response.data.message });
this.$refs.userUpdateAndCreateModal.close();
this.$refs.userUpdateAndCreateModal.close();
window.location.reload();
})
.catch (error => {
this.isLoading = false;
window.location.reload();
})
.catch (error => {
this.isLoading = false;
this.$emitter.emit('add-flash', { type: 'error', message: error.response.data.message });
this.$emitter.emit('add-flash', { type: 'error', message: error.response.data.message });
this.$refs.userUpdateAndCreateModal.close();
});
console.log(userForm.get('file'));
this.$refs.userUpdateAndCreateModal.close();
});
},
},
});
Expand Down

0 comments on commit dadf3b0

Please sign in to comment.