course.js 504 B

1234567891011121314
  1. export const state = () => ({
  2. items : []
  3. })
  4. export const actions = {
  5. async fetchCourses({commit}) {
  6. console.log('store/course.js actions > fetchCourses')
  7. const courses = await this.$axios.$get('/api/v1/products')
  8. console.log('store/course.js actions > fetchCourses > await this.$axios.$get')
  9. commit('setItems', {resource: 'course', items: courses}, {root: true})
  10. console.log('store/course.js actions > fetchCourses > await this.$axios.$get > commit')
  11. return state.items
  12. }
  13. }