Skip to content

Instantly share code, notes, and snippets.

@sadick254
Created June 17, 2018 08:55
Show Gist options
  • Save sadick254/d4006f2869cee8eb2ffa457f774327cc to your computer and use it in GitHub Desktop.
Save sadick254/d4006f2869cee8eb2ffa457f774327cc to your computer and use it in GitHub Desktop.
export async function addVehicle(userId, vehicle) {
return api.addVehicle(userId, vehicle, axios).then(data => {
if (!data.errors) {
store.dispatch({
type: types.ADD_VEHICLE,
vehicle: data.data.addVehicle
});
return data;
}
return Promise.reject(data.errors);
});
}
export async function updateVehicle(vehicle, index) {
return api.updateVehicle(vehicle, axios).then(data => {
if (!data.errors) {
store.dispatch({
type: types.UPDATE_VEHICLE,
vehicle: data.data.updateVehicle,
index
});
return data;
}
return Promise.reject(data.errors);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment