diff --git a/src/apis/common.js b/src/apis/common.js index 7664c88..35571e7 100644 --- a/src/apis/common.js +++ b/src/apis/common.js @@ -12,23 +12,18 @@ export function getComboCodeList(params) { } // TODO: 헤더에서 파일 정보 읽을 수 있도록 변경 필요 -export function fileDownload(id, filename, alert) { - return async () => { - await axios - .get(GET_FILE_DOWNLOAD + id, { - responseType: 'blob' // 'arrayBuffer', - // withCredentials: process.env.NODE_ENV === 'development' - // headers: { Authorization: window.localStorage.getItem(ACCESS_TOKEN_NAME) } - }) - // eslint-disable-next-line consistent-return - .then((res) => { - if (res.isAxiosError) { - alert.show('파일을 다운로드 할 수 없습니다[파일정보 오류]'); - return false; - } - FileSaver.saveAs(res, filename); - }); - }; +export async function fileDownload(id, filename, alert) { + await axios + .get(GET_FILE_DOWNLOAD + id, { + responseType: 'blob' // 'arrayBuffer', + // withCredentials: process.env.NODE_ENV === 'development' + // headers: { Authorization: window.localStorage.getItem(ACCESS_TOKEN_NAME) } + }) + // eslint-disable-next-line consistent-return + .then((res) => { + if (res.isAxiosError) alert.show('파일을 다운로드 할 수 없습니다 [파일정보 오류]'); + else FileSaver.saveAs(res, filename); + }); } export function setRowId(params, idx) { diff --git a/src/commons/XitCmm.js b/src/commons/XitCmm.js index 22502b7..cce4ff9 100644 --- a/src/commons/XitCmm.js +++ b/src/commons/XitCmm.js @@ -79,7 +79,7 @@ const XitCmm = { html: message, // imageUrl: timer: 3000 - }).then((r) => {}); + }).then(() => {}); return false; }, @@ -94,7 +94,7 @@ const XitCmm = { html: message, // imageUrl: timer: 3000 - }).then((r) => {}); + }).then(() => {}); return false; }, diff --git a/src/views/biz/board/PublicBoardForm.jsx b/src/views/biz/board/PublicBoardForm.jsx index 4a5dffd..56af0ff 100644 --- a/src/views/biz/board/PublicBoardForm.jsx +++ b/src/views/biz/board/PublicBoardForm.jsx @@ -12,9 +12,9 @@ import 'react-quill/dist/quill.snow.css'; // project imports import InputLabel from 'ui-component/extended/Form/InputLabel'; -import opstBizService from '../../../apis/OpstBizService'; import { Delete, FileDownload, FileUpload, List, Save } from '@mui/icons-material'; +import { fileDownload } from '../../../apis/common'; const PublicBoardForm = (props) => { // eslint-disable-next-line react/prop-types @@ -121,7 +121,7 @@ const PublicBoardForm = (props) => { alert.show('등록된 파일이 없습니다.'); return; } - opstBizService.fileDownload(inCode, inFilename, alert); + fileDownload(inCode, inFilename, alert).then(() => {}); }; return (