117
actions: {
async getLeads({commit}) {
commit('setError', "");
await axios.get('/lead/get')
.then(response => {
commit('setLeads', response.data);
})
.catch(error => {
commit('setError', error.response.data)
throw error
})
},
async getStates({commit}) {
commit('setError', "");
await axios.get('/lead/state')
.then(response => {
commit('setStates', response.data);
})
.catch(error => {
commit('setError', error.response.data)
throw error
})
},
async addLeads({commit, dispatch}, payload) {
commit('setError', "");
await axios.post('/lead/add', payload)
.then(response => {
if (response.data.success) {
dispatch('getLeads');
console.log(response.data.success);
} else {
commit('setError', response.data)
}
})
.catch(error => {
commit('setError', error.response.data)
throw error
})
},
async getLead({commit}, payload) {
await axios.post('/lead/getFull', payload)
.then(response => {
commit('setLead', response.data);
})
.catch(error => {
commit('setError', error.response.data)