The goal of this exercise is to manage your TODOs without full page refreshes by using Vue. No specific instructions, just guidelines based on what you've already done.
- Follow the video to get started.
- Check out yesterday's component
- Check out yesterday's template
// Get collection of "things" from server
var self = this
$.ajax({
method: "GET",
url: "/api/things"
}).then(function (data) {
console.log("promise: ", data)
})
// Create new "thing"
var self = this
$.ajax({
method: "POST",
url: "/api/things"
data: self.newThing
}).then(function (data) {
self.newThing = {}
self.things.push(data)
console.log("promise: ", data)
})
// Save existing object "thing" to server
methods: {
someHandler: function (thing) {
var self = this
$.ajax({
method: "PATCH",
url: "/api/things/" + self.thing.id,
data: self.thing
}).then(function (data) {
console.log("promise: ", data)
})
}
}