Refactor image fetching in Banner and Logo editors to use our API client

This commit is contained in:
2025-04-17 22:46:55 -04:00
parent 8850f55dbf
commit b455f29d07
2 changed files with 12 additions and 8 deletions

View File

@@ -115,11 +115,13 @@ const onFileSelected = (event) => {
const startEditing = () => {
if (fileUrl.value && fileUrl.value !== fallbackUrl) {
// Create a temporary file from the current image URL
fetch(fileUrl.value)
.then(res => res.blob())
.then(blob => {
// Use our API client to get the image
client.get(fileUrl.value, { responseType: 'blob' })
.then(response => {
const blob = response.data
selectedFile.value = new File([blob], 'current-image.jpg', { type: 'image/jpeg' })
// Create a local URL for the cropper
fileUrl.value = URL.createObjectURL(blob)
showCropper.value = true
})
.catch(error => {

View File

@@ -118,11 +118,13 @@ const onFileSelected = (event) => {
const startEditing = () => {
if (fileUrl.value && fileUrl.value !== fallbackUrl) {
// Create a temporary file from the current image URL
fetch(fileUrl.value)
.then(res => res.blob())
.then(blob => {
// Use our API client to get the image
client.get(fileUrl.value, { responseType: 'blob' })
.then(response => {
const blob = response.data
selectedFile.value = new File([blob], 'current-image.jpg', { type: 'image/jpeg' })
// Create a local URL for the cropper
fileUrl.value = URL.createObjectURL(blob)
showCropper.value = true
})
.catch(error => {