Created
June 17, 2018 08:55
-
-
Save sadick254/d4006f2869cee8eb2ffa457f774327cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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