Sep 15, 2022
0
Level 4
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
Please or to participate in this conversation.