Skip to content
Advertisement

Axios PUT request not sending all data to server JS

My problem is that I am sending an axios request with certain data, however, not all of the data is being updated in the user model. See my code below:

Front-End code with axios request:

JavaScript

User model in the backend:

JavaScript

Update controller in the backend:

JavaScript

Address and phone number are updating correctly, however, nationalid will not update for the life of me.

Advertisement

Answer

I found the error in my code, I forgot to change line #8 in the frontend file from const { natId, address, phone, error } to const { nationalid, address, phone, error } to match the name in the backend model.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement