123456789101112131415161718192021 |
- export const state = () => ({
- heroes: []
- })
- export const actions = {
- async fetchHeroes({state, commit}) {
- const heroes = await this.$axios.$get('/api/v1/product-heroes')
- if(heroes.isAxiosError === true){
- console.log(data.data)
- return Error('')
- }
- commit('setHeroes', heroes)
- return state.heroes
- }
- }
- export const mutations = {
- setHeroes(state, heroes) {
- state.heroes = heroes
- }
- }
|