Parsing body number from autocod. Fixing error with null vin
This commit is contained in:
parent
3b77fdd528
commit
7d00a77f8b
@ -44,6 +44,7 @@ class Vehicle {
|
|||||||
v.pts = report.fields.identifiers.vehicle.pts;
|
v.pts = report.fields.identifiers.vehicle.pts;
|
||||||
v.sts = report.fields.identifiers.vehicle.sts;
|
v.sts = report.fields.identifiers.vehicle.sts;
|
||||||
v.vin1 = report.fields.identifiers.vehicle.vin;
|
v.vin1 = report.fields.identifiers.vehicle.vin;
|
||||||
|
v.vin2 = report.fields.identifiers.vehicle.body;
|
||||||
v.photos = report.fields.images.photos.items.map(p => {
|
v.photos = report.fields.images.photos.items.map(p => {
|
||||||
return {
|
return {
|
||||||
brand: p.vehicle.brand.name,
|
brand: p.vehicle.brand.name,
|
||||||
|
|||||||
@ -64,7 +64,11 @@ router.post('/check', async (req, res) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vehicle = autocod.value;
|
vehicle = autocod.value;
|
||||||
let vinMatch = vin01.value.vin1.match(RegExp(vehicle.vin1.replace(/\*/g, '.')));
|
let vinMatch = false;
|
||||||
|
if(vin01.value.vin1 && vehicle.vin1) {
|
||||||
|
vinMatch = vin01.value.vin1.match(RegExp(vehicle.vin1.replace(/\*/g, '.')));
|
||||||
|
}
|
||||||
|
|
||||||
if(vehicle.vin1 && vinMatch) {
|
if(vehicle.vin1 && vinMatch) {
|
||||||
vehicle.vin1 = vin01.value.vin1;
|
vehicle.vin1 = vin01.value.vin1;
|
||||||
vehicle.vin2 = vin01.value.vin2;
|
vehicle.vin2 = vin01.value.vin2;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user