커뮤니티 파일 다운로드 수정

This commit is contained in:
leeyongjae 2024-10-17 16:39:26 +09:00
parent 7179b2bdca
commit ca9c20bd37

View File

@ -8,8 +8,10 @@ export const handleFileDown = async (file) => {
const params = new URLSearchParams({ const params = new URLSearchParams({
encodeFileNo: file.encodeFileNo, encodeFileNo: file.encodeFileNo,
}) })
const options = { responseType: 'blob' }
const apiUrl = `${url}?${params.toString()}` const apiUrl = `${url}?${params.toString()}`
await promiseGet({ url: apiUrl, responseType: 'blob' })
await promiseGet({ url: apiUrl, option: options })
.then((resultData) => { .then((resultData) => {
if (resultData) { if (resultData) {
const blob = new Blob([resultData.data], { type: resultData.headers['content-type'] || 'application/octet-stream' }) const blob = new Blob([resultData.data], { type: resultData.headers['content-type'] || 'application/octet-stream' })
@ -25,7 +27,7 @@ export const handleFileDown = async (file) => {
} }
}) })
.catch((error) => { .catch((error) => {
alert(error.response.data.message) alert('File does not exist.')
}) })
} }