Update remote.js for vue-resource

This commit is contained in:
Raymonzut
2020-04-19 18:26:06 +02:00
parent 307e71408b
commit a1a09a59ab
2 changed files with 10 additions and 30 deletions
+10 -5
View File
@@ -1,7 +1,12 @@
module.exports = {
postData: [
{ title: 'A walk in the park' },
{ title: 'Down the road', author: 'Alice' },
{ title: 'On a summer day', author: 'Bob' },
],
getPosts: function() {
this.$http
.get('http://localhost:5000/api/posts')
.then(res => {
this.posts = res.body
})
.catch(err => {
console.log(`Error: ${err}`)
})
},
}