Updating method and action name and awaiting data before page change on vehicle style page
This commit is contained in:
parent
d160a09c3b
commit
80a4de2cc7
4 changed files with 9 additions and 8 deletions
|
|
@ -5,7 +5,7 @@ const storeActions = {
|
|||
GET_VEHICLE_MAKES: "getVehicleMakes",
|
||||
GET_VEHICLE_MODELS: "getVehicleModels",
|
||||
GET_VEHICLE_STYLES: "getVehicleStyles",
|
||||
GET_VEHICLE: "getVehicle",
|
||||
SET_VEHICLE: "setVehicle",
|
||||
GET_DAMAGE_OPTIONS: "getDamageOptions",
|
||||
GET_EVOX_IMAGE: "getEvoxImage",
|
||||
LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms",
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ describe("vehicle-style.vue", () => {
|
|||
},
|
||||
actionList: [
|
||||
{
|
||||
actionName: storeActions.GET_VEHICLE,
|
||||
actionName: storeActions.SET_VEHICLE,
|
||||
data: 'mockData'
|
||||
}
|
||||
]
|
||||
|
|
@ -151,7 +151,7 @@ describe("vehicle-style.vue", () => {
|
|||
|
||||
//Act
|
||||
vehicleStyle.beforeRouteEnter.call(wrapper.vm, { query: { fmgPage: "vehicle-style" } }, undefined, (c) => c(wrapper.vm));
|
||||
wrapper.vm.selectVehicle();
|
||||
wrapper.vm.setVehicle();
|
||||
await nextTick();
|
||||
|
||||
//Assert
|
||||
|
|
|
|||
|
|
@ -68,16 +68,17 @@ export default {
|
|||
// route to move backwards
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||
},
|
||||
selectVehicle() {
|
||||
this.dispatchNonBlockingStoreAction(this.storeActions.GET_VEHICLE, {year: this.$store.getters.vehicle.year, make: this.$store.getters.vehicle.make, model: this.$store.getters.vehicle.model, style: this.$store.getters.vehicle.style});
|
||||
setVehicle() {
|
||||
return this.dispatchNonBlockingStoreAction(this.storeActions.SET_VEHICLE, {year: this.$store.getters.vehicle.year, make: this.$store.getters.vehicle.make, model: this.$store.getters.vehicle.model, style: this.$store.getters.vehicle.style});
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
selectedStyle(style) {
|
||||
this.$store.commit(this.storeMutations.UPDATE_STYLE, style);
|
||||
this.selectVehicle();
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_STYLE, this.$route);
|
||||
this.setVehicle().then(() => {
|
||||
this.$router.navigate(this.navigationScenarios.SELECTED_STYLE, this.$route);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ export default createStore({
|
|||
payload: {},
|
||||
});
|
||||
},
|
||||
getVehicle(context, {year, make, model, style}) {
|
||||
setVehicle(context, {year, make, model, style}) {
|
||||
return globalMethods.callHttpClient({
|
||||
methods: endpoints.GetVehicle.method,
|
||||
endpoint: `${endpoints.GetVehicle.url}/${year}/${make}/${model}/${style}`,
|
||||
|
|
|
|||
Loading…
Reference in a new issue