added not_found

This commit is contained in:
H0mire 2024-05-04 18:29:03 +02:00
parent 3456e27d25
commit a612e7f3ef

View file

@ -127,6 +127,7 @@ const WaifuImage = (taglist) => {
'download': ImageState('downloading', 'Downloading image'),
'done': ImageState('done', 'Finished!'),
'error': ImageState('error', 'Error'),
'notfound': ImageState('error', 'Not found!'),
},
});
const downloadIndicator = MarginRevealer({
@ -204,6 +205,10 @@ const WaifuImage = (taglist) => {
thisBlock.attribute.imageData = imageData;
const { status, signature, url, extension, source, dominant_color, is_nsfw, width, height, tags } = thisBlock.attribute.imageData;
thisBlock.attribute.isNsfw = is_nsfw;
if (status == 404) {
downloadState.shown = 'notfound';
return;
}
if (status != 200) {
downloadState.shown = 'error';
return;