fix(products): PC 촬영 시 이미지 데이터 null 버그 수정
- closeImageModal() 호출 전 imageData 로컬 변수에 저장 - closeImageModal()에서 capturedImageData = null 초기화로 인한 버그
This commit is contained in:
parent
3507d17dc5
commit
3631da2953
@ -1884,13 +1884,15 @@
|
|||||||
if (!capturedImageData) { alert('촬영된 이미지가 없습니다'); return; }
|
if (!capturedImageData) { alert('촬영된 이미지가 없습니다'); return; }
|
||||||
const code = imgModalBarcode || imgModalDrugCode;
|
const code = imgModalBarcode || imgModalDrugCode;
|
||||||
const name = imgModalName;
|
const name = imgModalName;
|
||||||
closeImageModal();
|
const drugCode = imgModalDrugCode;
|
||||||
|
const imageData = capturedImageData; // 먼저 저장!
|
||||||
|
closeImageModal(); // 이 후 capturedImageData = null 됨
|
||||||
showToast(`"${name}" 이미지 저장 중...`);
|
showToast(`"${name}" 이미지 저장 중...`);
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`/api/admin/product-images/${code}/upload`, {
|
const res = await fetch(`/api/admin/product-images/${code}/upload`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ image_data: capturedImageData, product_name: name, drug_code: imgModalDrugCode })
|
body: JSON.stringify({ image_data: imageData, product_name: name, drug_code: drugCode })
|
||||||
});
|
});
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
if (data.success) { showToast('✅ 이미지 저장 완료!', 'success'); searchProducts(); }
|
if (data.success) { showToast('✅ 이미지 저장 완료!', 'success'); searchProducts(); }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user