|
|
@ -92,11 +92,15 @@ export function QuestionPhoto({ |
|
|
if (fileInputRef.current) { |
|
|
if (fileInputRef.current) { |
|
|
fileInputRef.current.value = ""; |
|
|
fileInputRef.current.value = ""; |
|
|
} |
|
|
} |
|
|
setToastMessage( |
|
|
|
|
|
t["Failed to load image. Please try uploading again."] ?? |
|
|
|
|
|
"Failed to load image. Please try uploading again.", |
|
|
|
|
|
); |
|
|
|
|
|
}, [question, setAnswerValue, t]); |
|
|
|
|
|
|
|
|
// Only show the toast if the user was actively uploading;
|
|
|
|
|
|
// stale stored URLs from previous sessions fail silently.
|
|
|
|
|
|
if (isUploading || isInitiatorRef.current) { |
|
|
|
|
|
setToastMessage( |
|
|
|
|
|
t["Failed to load image. Please try uploading again."] ?? |
|
|
|
|
|
"Failed to load image. Please try uploading again.", |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
}, [question, setAnswerValue, t, isUploading]); |
|
|
|
|
|
|
|
|
const uploadTmpMediaMutation = useUploadTmpMediaMutation({ |
|
|
const uploadTmpMediaMutation = useUploadTmpMediaMutation({ |
|
|
onSuccess: (response) => { |
|
|
onSuccess: (response) => { |
|
|
@ -256,8 +260,7 @@ export function QuestionPhoto({ |
|
|
mediaType: "image", |
|
|
mediaType: "image", |
|
|
source: pickerSource as any, |
|
|
source: pickerSource as any, |
|
|
picker_type: pickerType as any, |
|
|
picker_type: pickerType as any, |
|
|
returnAs: "upload", |
|
|
|
|
|
uploadUrl: `${window.location.origin}/api/proxy?__proxyPath=/upload-tmp-media/`, |
|
|
|
|
|
|
|
|
returnAs: "base64", |
|
|
fieldName: "file", |
|
|
fieldName: "file", |
|
|
allowedExtensions: |
|
|
allowedExtensions: |
|
|
extensions.length > 0 ? extensions : ["jpg", "jpeg", "png", "webp"], |
|
|
extensions.length > 0 ? extensions : ["jpg", "jpeg", "png", "webp"], |
|
|
|