get image update
This commit is contained in:
parent
51436141a4
commit
339abe4c84
2 changed files with 28 additions and 12 deletions
|
|
@ -15,22 +15,29 @@ const fileList = ref([])
|
|||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const imgUrl = await getImageUrl(props.merch.merch_uuid, 'thumbnail')
|
||||
const imgUrl = getImageUrl(props.merch.merch_uuid, 'thumbnail')
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
const img = new Image()
|
||||
img.src = imgUrl
|
||||
img.onload = () => resolve(imgUrl)
|
||||
img.onerror = () => reject(new Error('Image not found'))
|
||||
})
|
||||
|
||||
fileList.value = [
|
||||
{
|
||||
name: 'full.jpg',
|
||||
name: 'thumbnail.jpg',
|
||||
url: imgUrl,
|
||||
status: 'finished',
|
||||
},
|
||||
]
|
||||
} catch (error) {
|
||||
fileList.value = []
|
||||
if (!error.message?.includes('404')) {
|
||||
console.error('Error getting image: ', error)
|
||||
if (!error.message.includes('404')) {
|
||||
console.error('Error getting thumbnail: ', error)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue