Closed Elizaphuyal closed 3 years ago
@dibas-np I also had same kind of issue when working with json server, so, I think I could help you on this. let me test the code and will get back to you with possible solution.
I think the page is being reloaded before the data is updated through update button.
When you enter the submit button, the page gets reloaded because of its default reloading behaviour of form. And only after that button pop up is coming, so your data is not updated.
You can just change the Event Listner of submit button and use update button as its event trigger. Or you can just make update button as event listner for the updating action.
I hope this helps to fixing your bug.
Rabins, you are right. The problem was that the page was reloading before update function was being called. I am using SweetAlert popup for the update action. But when the value wasn't being passed inside SweetAlert popup (which didn't passed data to the update function as it was inside popup), Hence update didn't receive any value. I have make it so that popup is called inside update function.
@Elizaphuyal Please run the test again and let me know.
I test it and it is working as required. I filled the empty category and edited name value. It works fine now. Updated
Good job @dibas-np . Happy to see my tips worked to your issue to some extent. Lets wait for our BA to have say on this. good luck
I ran the test again. Now everything is working as expected. Good Job!
Steps to reproduce
Current behaviour The data isn't being updated. It is the same as it wasn't updated.
Expected behaviour Data should be updated in table.
Screenshots
As can be seen above, it is same before and after updating data.