Merge branch 'develop' into feature/digital/SSR-178
This commit is contained in:
commit
b975bfc97c
2 changed files with 40 additions and 0 deletions
|
|
@ -31,6 +31,10 @@ const endpoints = {
|
||||||
url: "/parts/api/v1/parts/damage-options",
|
url: "/parts/api/v1/parts/damage-options",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
},
|
},
|
||||||
|
GetPartsOrQuestions: {
|
||||||
|
url: "/parts/api/v1/parts/parts-or-questions",
|
||||||
|
method: "POST",
|
||||||
|
},
|
||||||
GetParts: {
|
GetParts: {
|
||||||
url: "/parts/api/v1/parts/parts",
|
url: "/parts/api/v1/parts/parts",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,42 @@ export const useMainStore = defineStore({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// PartsOrQuestions API Actions
|
||||||
|
async getPartsOrQuestions() {
|
||||||
|
const vehicle = this.vehicle;
|
||||||
|
const damage = this.damage;
|
||||||
|
const order = this.order;
|
||||||
|
|
||||||
|
const carId = vehicle.carId;
|
||||||
|
const glassArray = damage.glassToReplace;
|
||||||
|
// zip code is not available yet at the time of writing
|
||||||
|
// const zipCode = order.serviceLocation.zipCode;
|
||||||
|
// To Do: replace with actual zip code
|
||||||
|
const zipCode = '43215';
|
||||||
|
const vin = vehicle.vin;
|
||||||
|
|
||||||
|
// create a new array to avoid mutating state
|
||||||
|
const glassArrayForPayload = convertGlassPieceNamingForApi(glassArray);
|
||||||
|
|
||||||
|
const response = await globalMethods.callHttpClient({
|
||||||
|
method: endpoints.GetPartsOrQuestions.method,
|
||||||
|
endpoint: endpoints.GetPartsOrQuestions.url,
|
||||||
|
payload: {
|
||||||
|
carId: carId,
|
||||||
|
glassPieces: glassArrayForPayload,
|
||||||
|
zip: zipCode,
|
||||||
|
vin: vin,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Flatten location and name properties
|
||||||
|
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(
|
||||||
|
response.data.partsOrQuestions
|
||||||
|
);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
},
|
||||||
|
|
||||||
async getParts() {
|
async getParts() {
|
||||||
const vehicle = this.getters.vehicle;
|
const vehicle = this.getters.vehicle;
|
||||||
const damage = this.getters.damage;
|
const damage = this.getters.damage;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue