commit
9698302788
3 changed files with 33 additions and 54 deletions
|
|
@ -216,9 +216,9 @@ export default {
|
|||
styleQuestionInitialDataPromise
|
||||
)
|
||||
vm.initializeMMSComponent(
|
||||
resultMap.makeQuestionInitialData?.response?.data,
|
||||
resultMap.modelQuestionInitialData?.response?.data,
|
||||
resultMap.styleQuestionInitialData?.response?.data
|
||||
resultMap.makeQuestionInitialData,
|
||||
resultMap.modelQuestionInitialData,
|
||||
resultMap.styleQuestionInitialData
|
||||
);
|
||||
});
|
||||
},
|
||||
|
|
@ -227,8 +227,8 @@ export default {
|
|||
async selectedYear(year) {
|
||||
if (year) {
|
||||
const result = await this.getMakeOptions(year);
|
||||
if (result?.year == year) {
|
||||
this.makeOptions = result?.response?.data;
|
||||
if (this.selectedYear == year) {
|
||||
this.makeOptions = result?.data;
|
||||
if (this.selectedYearfromStore() !== year) {
|
||||
this.selectedMake = null;
|
||||
this.selectedModel = null;
|
||||
|
|
@ -247,8 +247,8 @@ export default {
|
|||
async selectedMake(make) {
|
||||
if (make) {
|
||||
const result = await this.getModelOptions(this.selectedYear, make);
|
||||
if (decodeURIComponent(result?.make) == make) {
|
||||
this.modelOptions = result?.response?.data;
|
||||
if (this.selectedMake == make) {
|
||||
this.modelOptions = result?.data;
|
||||
if (this.modelOptions.length === 1) this.selectedModel = this.modelOptions[0];
|
||||
else {
|
||||
this.selectedModel = null;
|
||||
|
|
@ -270,8 +270,8 @@ export default {
|
|||
this.selectedMake,
|
||||
model
|
||||
);
|
||||
if (decodeURIComponent(result?.model) == model) {
|
||||
this.styleOptions = result?.response?.data;
|
||||
if (this.selectedModel == model) {
|
||||
this.styleOptions = result?.data;
|
||||
if (this.styleOptions.length === 1) {
|
||||
const sameStyle = this.selectedStyle === this.styleOptions[0];
|
||||
this.selectedStyle = this.styleOptions[0];
|
||||
|
|
|
|||
|
|
@ -854,54 +854,33 @@ export const actions = {
|
|||
},
|
||||
|
||||
getVehicleMakes(context, { payload: { year }, pageNameToLog }) {
|
||||
return globalMethods
|
||||
.callHttpClient({
|
||||
method: endpoints.GetVehicleMakes.method,
|
||||
endpoint: `${endpoints.GetVehicleMakes.url}/${year}`,
|
||||
payload: {},
|
||||
logApiCall: true,
|
||||
pageNameToLog: pageNameToLog,
|
||||
})
|
||||
.then((response) => {
|
||||
return {
|
||||
response,
|
||||
year,
|
||||
};
|
||||
});
|
||||
return globalMethods.callHttpClient({
|
||||
method: endpoints.GetVehicleMakes.method,
|
||||
endpoint: `${endpoints.GetVehicleMakes.url}/${year}`,
|
||||
payload: {},
|
||||
logApiCall: true,
|
||||
pageNameToLog: pageNameToLog,
|
||||
});
|
||||
},
|
||||
|
||||
getVehicleModels(context, { payload: { year, make }, pageNameToLog }) {
|
||||
return globalMethods
|
||||
.callHttpClient({
|
||||
method: endpoints.GetVehicleModels.method,
|
||||
endpoint: `${endpoints.GetVehicleModels.url}/${year}/${make}`,
|
||||
payload: {},
|
||||
logApiCall: true,
|
||||
pageNameToLog: pageNameToLog,
|
||||
})
|
||||
.then((response) => {
|
||||
return {
|
||||
response,
|
||||
make,
|
||||
};
|
||||
});
|
||||
return globalMethods.callHttpClient({
|
||||
method: endpoints.GetVehicleModels.method,
|
||||
endpoint: `${endpoints.GetVehicleModels.url}/${year}/${make}`,
|
||||
payload: {},
|
||||
logApiCall: true,
|
||||
pageNameToLog: pageNameToLog,
|
||||
});
|
||||
},
|
||||
|
||||
getVehicleStyles(context, { payload: { year, make, model }, pageNameToLog }) {
|
||||
return globalMethods
|
||||
.callHttpClient({
|
||||
method: endpoints.GetVehicleStyles.method,
|
||||
endpoint: `${endpoints.GetVehicleStyles.url}/${year}/${make}/${model}`,
|
||||
payload: {},
|
||||
logApiCall: true,
|
||||
pageNameToLog: pageNameToLog,
|
||||
})
|
||||
.then((response) => {
|
||||
return {
|
||||
response,
|
||||
model,
|
||||
};
|
||||
});
|
||||
return globalMethods.callHttpClient({
|
||||
method: endpoints.GetVehicleStyles.method,
|
||||
endpoint: `${endpoints.GetVehicleStyles.url}/${year}/${make}/${model}`,
|
||||
payload: {},
|
||||
logApiCall: true,
|
||||
pageNameToLog: pageNameToLog,
|
||||
});
|
||||
},
|
||||
|
||||
getVehicle(context, { payload: { year, make, model, style }, pageNameToLog }) {
|
||||
|
|
|
|||
|
|
@ -493,7 +493,7 @@ describe("Actions", () => {
|
|||
pageNameToLog: "test",
|
||||
});
|
||||
|
||||
expect(response.response.data).toEqual(["Acura", "Honda"]);
|
||||
expect(response.data).toEqual(["Acura", "Honda"]);
|
||||
});
|
||||
|
||||
it("getVehicleModels action, should return models list", async () => {
|
||||
|
|
@ -511,7 +511,7 @@ describe("Actions", () => {
|
|||
pageNameToLog: "test",
|
||||
});
|
||||
|
||||
expect(response.response.data).toEqual(["ILX", "RDX"]);
|
||||
expect(response.data).toEqual(["ILX", "RDX"]);
|
||||
});
|
||||
|
||||
it("getVehicleStyles action, should return models list", async () => {
|
||||
|
|
@ -529,7 +529,7 @@ describe("Actions", () => {
|
|||
pageNameToLog: "test",
|
||||
});
|
||||
|
||||
expect(response.response.data).toEqual({ style: "4 DOOR SEDAN" });
|
||||
expect(response.data).toEqual({ style: "4 DOOR SEDAN" });
|
||||
});
|
||||
|
||||
it("getVehicle action, should get vehicle data ", async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue