Untitled
unknown
javascript
3 years ago
826 B
3
Indexable
export function* fetchDownloadAttachmentInterviewResult(params) { try { yield put({ type: types.RECRUITMENT_PR_SET_LOADER, value: true }) const response = yield call(axios.get, params.url, { responseType: 'arraybuffer' /** <-- responseType should be set to arraybuffer */ }) if (response.status === 200) { const blob = new Blob([response.data]) const link = document.createElement('a') link.href = window.URL.createObjectURL(blob) link.download = params.fileName link.click() yield put({ type: types.RECRUITMENT_PR_SET_LOADER, value: false }) } } catch (e) { yield put({ type: types.RECRUITMENT_PR_SET_LOADER, value: false }) console.log('REASON', e) } }
Editor is loading...