|
@@ -50,6 +50,7 @@
|
|
|
<div class="container">
|
|
|
<editor
|
|
|
@editorMounted="initBlogContent"
|
|
|
+ @editorUpdated="updateBlog"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -74,11 +75,24 @@ export default {
|
|
|
await store.dispatch('instructor/blog/fetchBlogById', params.id)
|
|
|
},
|
|
|
methods: {
|
|
|
+ // initBlogContent(editor) {
|
|
|
+ // if (this.blog && this.blog.content) {
|
|
|
+ // editor.setContent(this.blog.content)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
initBlogContent(initContent) {
|
|
|
debugger
|
|
|
if (this.blog && this.blog.content) {
|
|
|
initContent(this.blog.content)
|
|
|
}
|
|
|
+ },
|
|
|
+ async updateBlog(blogData) {
|
|
|
+ try{
|
|
|
+ await this.$store.dispatch('instructor/blog/updateBlog', {data: blogData, id: this.blog._id})
|
|
|
+ this.$toasted.success('Blog Updated!', {duration: 2000})
|
|
|
+ }catch(error){
|
|
|
+ this.$toasted.error('Blog cannot be saved!', {duration: 2000})
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|