[Vuejs]-Axios isn't filling store on mount

0👍

Dumb me, this did the trick:

Fetch:

async fetch ({store}) {
  await store.dispatch('getMediaList')
}

Actions:

async getMediaList ({commit}) {
  try {
    const { data } = await API.get(`/wp/media`)
    commit('setMediaList', data)
  } catch (error) {
    console.log(error)
  }
}

Leave a comment