|
@@ -1,5 +1,5 @@
|
|
|
export const state = () => ({
|
|
|
-
|
|
|
+ item: {}
|
|
|
})
|
|
|
|
|
|
export const actions = {
|
|
@@ -12,9 +12,23 @@ export const actions = {
|
|
|
} catch (error) {
|
|
|
return error
|
|
|
}
|
|
|
+ },
|
|
|
+ async fetchBlogById({commit}, blogId) {
|
|
|
+ try {
|
|
|
+ console.log('instructor/blog.js actions fetchBlogById call axios.$get->blogId')
|
|
|
+ const blog = await this.$axios.$get(`/api/v1/blogs/${blogId}`)
|
|
|
+ console.log('instructor/blog.js actions fetchBlogById done axios.$get->blogId')
|
|
|
+ console.log('courses.js mutations call setBlog')
|
|
|
+ commit('setBlog', blog)
|
|
|
+ console.log('courses.js mutations done setBlog')
|
|
|
+ } catch (error) {
|
|
|
+ return error
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export const mutations = {
|
|
|
-
|
|
|
+ setBlog(state, blog) {
|
|
|
+ state.item = blog
|
|
|
+ }
|
|
|
}
|