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