chore: refactor shouldShowImage

This commit is contained in:
Muhsin Keloth
2024-04-26 10:04:38 +05:30
parent b131d8e009
commit ff1286928d
@@ -7,6 +7,7 @@
<img
v-if="shouldShowImage"
class="rounded-xl h-[72px] w-[72px]"
:alt="name"
:src="src"
draggable="false"
@load="onImageLoad"
@@ -62,15 +63,7 @@ const imageLoadedError = ref(false);
const shouldShowUploadIcon = ref(false);
const fileInputRef = ref(null);
const shouldShowImage = computed(() => {
if (!props.src) {
return false;
}
if (hasImageLoaded.value) {
return !imageLoadedError.value;
}
return true;
});
const shouldShowImage = computed(() => props.src && !imageLoadedError.value);
const onImageLoadError = () => {
imageLoadedError.value = true;