diff --git a/bun.lockb b/bun.lockb
index f55fb2b..82f8b13 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/src/components/ImageModerator/ImageModerator.tsx b/src/components/ImageModerator/ImageModerator.tsx
index f82d4b1..ecf40ea 100644
--- a/src/components/ImageModerator/ImageModerator.tsx
+++ b/src/components/ImageModerator/ImageModerator.tsx
@@ -9,14 +9,17 @@ export interface ImageModeratorProps {
export default function ImageModerator({ acceptLabel, discardLabel }: ImageModeratorProps) {
const endpoint = "https://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=1&json=1";
- const [loading, setLoading] = useState(true);
+ const [isLoading, setIsLoading] = useState(true);
const [imageSrc, setImageSrc] = useState("");
const [imageAlt, setImageAlt] = useState("No image");
const getNewImage = () => {
setImageSrc("");
- setLoading(true);
- fetch(endpoint)
+ setIsLoading(true);
+ fetch(endpoint, {
+ method: "GET",
+ mode: "no-cors",
+ })
.then(response => {
if (!response.ok) throw new Error("Response was not ok");
return response.json();
@@ -26,10 +29,11 @@ export default function ImageModerator({ acceptLabel, discardLabel }: ImageModer
setImageSrc(imageUrl);
setImageAlt(imageUrl);
})
- .catch(_ => {
+ .catch(error => {
setImageAlt("Error");
+ console.error(error);
}).finally(() => {
- setLoading(false);
+ setIsLoading(false);
});
}
@@ -39,7 +43,7 @@ export default function ImageModerator({ acceptLabel, discardLabel }: ImageModer
display: "grid", gridTemplateColumns: "1fr 1fr",
gridTemplateRows: "1fr 50px", gridTemplateAreas: "'. .' '. .'", width: "100vw", height: "100vh"
}}>
- {loading ? Loading... :
+ {isLoading ? Loading... :
}