1👍
✅
I see you used PUT,DELETE,POST requests but no GET to fetch database? In other words you’re lacking fetchData
method in every change database has been made.
Supposedly every time you received response
in .then
you should allow your app fetchData()
via GET
from database mysql in every operation, similarly how things done in AJAX, if you don’t want to refresh page.
P/S the console.logs
like console.log("You have edited the data.");
doesn’t prove anything before you execute axios methods, the console should be put under .then
.then(function(response) {
console.log("You have REALLY updated the data in database.");
console.log(response);
})
Lastly, if you wished to use POST to get all updated records, you just do:
.then(function(response) {
console.log(response);
this.allRecords(); //fetchTask again
})
Source:stackexchange.com