Collect Film's nested data on mounted (Locations/Vehicles/People)

This commit is contained in:
2020-12-21 13:57:18 +01:00
parent fffbc87964
commit 67680804e2
5 changed files with 121 additions and 11 deletions

View File

@@ -9,13 +9,13 @@ export const mutations = {
};
export const actions = {
async getvehicle({ commit }, { id, callback = false }) {
async getVehicle({ commit }, { id, callback = false }) {
try {
const vehicle = await this.$axios.$get(`/api/vehicles/${id}`);
if (callback) return vehicle;
commit("setVehicle", vehicle);
} catch (e) {
throw Error("API Error occurred.");
throw Error(`API Error occurred: ${e.message}`);
}
}
};