Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rafidAhsan's avatar

How to call action from another action in vuex

on name1/action.js file I have

import axios from '@/libs/axios'

export default {
  profileImage: payload => axios.post('/profile', payload)
    .then(({ data }) => {
      console.log(data)
    }),

  basicDetails: ({ dispatch }, payload) => {
    const user = JSON.parse(sessionStorage.getItem('USER'))

    axios
      .put(`update/resume/${user.id}`, payload)
      .then(response => {
        if (response.data.success) {
          dispatch('auth/reload_user')
        }
      })
  },
}

on auth/action.js file I have

reload_user: ({ commit }) => axios.get('/user')
    .then(response => {
      commit('SAVE_USER_DATA', response.data)

      return response
    }),

but it gives error

vuex.esm.js?2f62:774 [vuex] unknown local action type: auth/reload_user, global type: candidateProfile/auth/reload_user
0 likes
0 replies

Please or to participate in this conversation.