Skip to content

Instantly share code, notes, and snippets.

@sadick254
Last active November 1, 2017 12:36
Show Gist options
  • Save sadick254/0fb52800d5f0a09435e23c4882378ce9 to your computer and use it in GitHub Desktop.
Save sadick254/0fb52800d5f0a09435e23c4882378ce9 to your computer and use it in GitHub Desktop.
minimizing vuex boilerplate
export const getUsers = ({commit}, params) => {
return axios.get('http://api.domain.com/users', {
params
}).then(resp => {
commit('GET_USERS_SUCCESS', resp.data)
return resp.data
})
}
export const getDrivers = ({commit}, params) => {
return axios.get('http://api.domain.com/drivers', {
params
}).then(resp => {
commit('GET_DRIVERS_SUCCESS', resp.data)
return resp.data
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment