Commit a43d2364 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

posts

parent 038b61a2
......@@ -301,12 +301,11 @@ export default {
message: [],
editedIndex: -1,
editedItem: {
name: "",
id: "",
ordering: "",
title: "",
category_id: "",
content: "",
user_id: "",
status: "",
created_at: "",
updated_at: "",
},
defaultItem: {
name: "",
......@@ -425,7 +424,10 @@ export default {
this.$bvModal.hide("modal-create");
self.$toast.success("Post created successfully!", {
duration: 3000,
});
})
this.editedItem = response.data.data
console.log(this.editedItem)
this.posts.push(this.editedItem)
})
.catch((errors) => {
this.$bvModal.hide("modal-create");
......@@ -487,7 +489,7 @@ export default {
this.eContent = item.content;
this.eStatus = item.status;
this.eUserId = item.user_id;
// this.eImages = item.images
this.editedIndex = this.posts.indexOf(item)
},
updatePost() {
const self = this;
......@@ -514,7 +516,10 @@ export default {
self.$toast.success("Post updated successfully!", {
duration: 3000,
});
console.log(response);
console.log(response)
this.editedItem = response.data.data
this.$bvModal.hide('modal-edit')
Object.assign(this.posts[this.editedIndex], this.editedItem)
})
.catch((error) => {
console.log(error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment