Skip to content

Commit

Permalink
fix: not add selected images in the image list in preview
Browse files Browse the repository at this point in the history
  • Loading branch information
Valimp committed Oct 23, 2024
1 parent 7fb002f commit a996b8d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/InfoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function ModalInfo({barcode}: ModalInfoProps) {
return `${import.meta.env.VITE_PO_IMAGE_URL}/images/products/${part1}/${part2}/${part3}/${part4}/${imageId}.${def}.jpg`;
}
const handleTicketInfo = () => {
axios.get(`${import.meta.env.VITE_PO_URL}/api/v2/product/${barcode}.json`).then((res) => {
axios.get(`${import.meta.env.VITE_PO_URL}/api/v2/product/${barcode}.json`).then((res) => {
const usedData: any = {
name: res.data.product.product_name || null,
barcode: res.data.code || null,
Expand All @@ -58,8 +58,9 @@ export default function ModalInfo({barcode}: ModalInfoProps) {
// loop through the images and build the url
if (res.data.product.images) {
Object.keys(res.data.product.images).forEach((key) => {
// if the key is not a number do nothing
if (isNaN(parseInt(key))) {
usedData.images[key] = buildUrl(barcode, key, '100', res.data.product.images[key].rev);
return;
} else {
usedData.images[key] = buildUrl(barcode, key, '100');
}
Expand Down

0 comments on commit a996b8d

Please sign in to comment.