Fix return type of detail queries (#8038)

This commit is contained in:
Oliver 2024-08-30 10:38:48 +10:00 committed by GitHub
parent 3951b3f56e
commit cc45c23915
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -403,17 +403,17 @@ export default function PartDetail() {
case 200:
return response.data;
default:
return null;
return {};
}
})
.catch(() => {
return null;
return {};
});
}
});
return (
data &&
data.overall_min &&
`${formatPriceRange(data.overall_min, data.overall_max)}${
part.units && ' / ' + part.units
}`
@ -443,19 +443,19 @@ export default function PartDetail() {
if (response.data.length > 0) {
return response.data[response.data.length - 1];
} else {
return null;
return {};
}
default:
return null;
return {};
}
})
.catch(() => {
return null;
return {};
});
}
});
if (data.quantity) {
if (data && data.quantity) {
return `${data.quantity} (${data.date})`;
} else {
return '-';
@ -482,11 +482,11 @@ export default function PartDetail() {
case 200:
return response.data[response.data.length - 1];
default:
return null;
return {};
}
})
.catch(() => {
return null;
return {};
});
}
});