Reactjs and mysql

I have been learning reactjs for front-end and springboot for back-end. I can say its such a nice experience :slight_smile:
Now i want to update my database row using axios from my front-end , That is a bit challenging for me as i have tried axios.post and axios.patch but still cant get it working. Would really appreciate yo’all 's help. Below is the current code that am working on which is not giving me what i want :frowning:

var onChange = (row) => {
   	  console.log(row)
   	
    axios.patch('https://localhost:8443/api/userProfileDetails/search/findByMsisdn?msisdn').then(response=>{
   		 console.log(response);
   		this.setState({
   			msisdn:row.msisdn
         	
         });	
     }).catch(error=>{
         console.log(error);
     })
 	   }

What do you mean by your code “not giving [you] what [you] want”? Is it doing anything at all or just resulting in errors (please include any error messages).

Also, have you tested your API to work without using axios?

After the user edit the row on the front-end , the application is suppose to take what ever the user have amended and save to the database .

Is not resulting to any errors :frowning: that worries me the most. The Api is working perfectly.

The API can’t be working perfectly and not doing what you want at the same time—you need to be more specific about your problem and help people to help you: error messages, what you have tried, what doesn’t work, what works… etc.

  • Are you able to read from the API (I assume you can)?
  • As I said in the previous post, have you tested your API without using axios?
  • Are you actually using developer tools and inspecting the console when you say “no errors”?
  • Have you tried console.log()ing the response returned by axios?
  • Do you have access to the server? And if so:
    • Is the server receiving your axios.post() and/or axios.pach() calls?
    • Does the server actually accept the PATCH HTTP method?
    • If the requests are received have you tried debugging by checking if the code that you expect to execute do in fact execute?

I must admit , you have been of great help; I got the attached error on my log

file:///home/fhatuwani/Pictures/Screenshot%20from%202017-11-27%2015-08-19.png

You have to look at you browser’s console if the request is not being made. Plus, from the screenshot, the problem is with your server-side code. Could you make Postman requests, to see if the API is working?

It doesn’t look like you’re sending any data that the user may have entered. the url query as is just sends the string msisdn.

I’m not familiar with axios.patch, but you may need to specify the data in a param block. Take a look at this issue, there are a number of comments showing required syntax.

There are also a number of exmaples in the dox