Fix ItemCard
This commit is contained in:
@@ -10,7 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@@ -27,8 +27,11 @@ export default function ItemCard({ item }: { item: Item }) {
|
||||
const fetchImage = async () => {
|
||||
try {
|
||||
const response = await fetch(`http://localhost:8085/image?uuid=${item.uuid}`); //image/* as base64
|
||||
const data = await response.text();
|
||||
setImageUrl("data:image/jpeg;base64," + data);
|
||||
var data = await response.text();
|
||||
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