As the title states, I need to refresh the page after an axios call function, but not before the promise has been received. The page is currently refreshing after the function fires but the promise is not received . What I am trying to do is to submit a blog post to the api, When I add the preventDefault function at the end everything works as it should.
here function:
handleSubmit(event){
axios.post("https://saulvegablog.devcamp.space/portfolio/portfolio_blogs", this.buildForm(), {withCredentials:true})
.then(response => {
this.props.handleSuccessfullFormSubmission(response.data);
}).catch(error => {
console.log("handlesubmit error for blog ", error)
})
event.preventDefault();
}