|  | 
| 5 | 5 |  <p class="modal-card-title">Edit Post</p> | 
| 6 | 6 |  </header> | 
| 7 | 7 |  <section class="modal-card-body"> | 
|  | 8 | + {{ post.id }} | 
| 8 | 9 |  <b-field label="Title"> | 
| 9 |  | - <input type="text" class="input" placeholder="Title" v-model="title"></input> | 
|  | 10 | + <input type="text" class="input" placeholder="Title" v-model="post.title"></input> | 
| 10 | 11 |  </b-field> | 
| 11 | 12 |  <b-field label="Content"> | 
| 12 |  | - <textarea class= "textarea" name="name" v-model="description" rows="8" cols="80" placeholder="Post content"></textarea> | 
|  | 13 | + <textarea class= "textarea" name="name" v-model="post.description" rows="8" cols="80" placeholder="Post content"></textarea> | 
| 13 | 14 |  </b-field> | 
| 14 | 15 |  </section> | 
| 15 | 16 |  <footer class="modal-card-foot"> | 
|  | 
| 22 | 23 | <script> | 
| 23 | 24 |  | 
| 24 | 25 | export default { | 
| 25 |  | - props:['title','description','id'], | 
|  | 26 | + props:['post'], | 
| 26 | 27 |  methods:{ | 
| 27 | 28 |  updatePost: function(){ | 
| 28 |  | - const updatedPost = new Object(); | 
| 29 |  | - updatedPost.description = this.description; | 
| 30 |  | - updatedPost.title = this.title; | 
| 31 |  | - updatedPost.id = this.id; | 
|  | 29 | + let updatedPost = new Object(); | 
|  | 30 | + updatedPost = this.post; | 
| 32 | 31 |  this.$http.put( | 
| 33 | 32 |  'api/v1/post', updatedPost | 
| 34 | 33 |  ).then(function (response) { | 
| 35 | 34 |  console.log(response); | 
| 36 | 35 |  }).catch(function(error){ | 
| 37 | 36 |  console.log(error); | 
| 38 |  | - }) | 
|  | 37 | + }); | 
|  | 38 | + console.log("Update"); | 
| 39 | 39 |  } | 
| 40 | 40 |  } | 
| 41 | 41 | } | 
|  | 
0 commit comments