hero.js 440 B

12345678910111213141516171819202122
  1. export const state = () => ({
  2. item: null
  3. })
  4. export const actions = {
  5. async createHero({commit, state}, courseHeroData) {
  6. const hero = await this.$axios.$post('/api/v1/product-heroes', courseHeroData)
  7. if(hero.isAxiosError === true){
  8. console.log(data.data)
  9. return Error('')
  10. }
  11. commit('setHero', hero)
  12. return state.item
  13. }
  14. }
  15. export const mutations = {
  16. setHero(state, hero) {
  17. state.item = hero
  18. }
  19. }