Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

243
Views
Axios Request Aborted

I have an axios post request which gets triggered when we click on button. But as soon as button is clicked it shows this error and page reloads

enter image description here

The function on which the request is getting triggered

const handleForm = async (e) => {
//Check username is unique
e.preventDefault();
const oldUserName = await doesUserNameExist(userName);
if (oldUserName) {
  activeUser.displayName = userName;
  const imgUrl = await uploadPhoto(activeUser?.displayName, profilePicture);
  const userFormData = {
    userName,
    bio,
    gender,
    age,
    uid: activeUser.uid,
    emailAddress: activeUser.email,
    accountCreatedOn: serverTimestamp(),
    lastSeen: serverTimestamp(),
    following: [''],
    followers: [''],
    role: 'user',
    status: '',
    photoURL: imgUrl ? imgUrl : activeUser?.photoURL,
  };

  //  await addUser(userFormData);
  const nodeData = {
    id: activeUser.uid,
    emailAddress: activeUser.email,
    userName,
  };
  await axios.post('path_to_api/api/user', nodeData, {
    headers: nodeData,
  }); 
}

Please Help. Thanks in advance!!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try this :

 await axios.post('path_to_api/api/user', nodeData); 
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!