Image on ProductInfo page
This commit is contained in:
@@ -59,11 +59,14 @@ export default function ProductInfo({ item }: { item: Item }) {
|
||||
const fetchImage = async () => {
|
||||
try {
|
||||
const response = await fetch(`http://localhost:8085/image?uuid=${item.uuid}`);
|
||||
const data = await response.text();
|
||||
var data = await response.text();
|
||||
if(data.length == 0) {
|
||||
console.error("Got emtpy picture for article ", item.uuid);
|
||||
}
|
||||
setImageUrl("data:image/jpeg;base64," + data);
|
||||
if(!data.startsWith("data:image/")) {
|
||||
data = "data:image/jpeg;base64," + data
|
||||
}
|
||||
setImageUrl(data);
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Laden des Bildes:", error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user