refactor(qualify): replace api CandidateExam
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m50s

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-06-25 14:53:59 +07:00
parent 16c21467e4
commit fd665b8b4d
3 changed files with 54 additions and 29 deletions

View file

@ -98,6 +98,9 @@ export default {
`${env.API_URI}/placement/candidate/pdf/${candidateId}`, `${env.API_URI}/placement/candidate/pdf/${candidateId}`,
downloadCandidateExam: (id: string) => downloadCandidateExam: (id: string) =>
`${periodExam}download/candidate-exam/${id}`, `${exam_report}candidate/candidate-new/${id}`,
downloadPassExam: (id: string) => `${periodExam}download/pass-exam/${id}`, downloadPassExam: (id: string) => `${periodExam}download/pass-exam/${id}`,
downloadCandidatePassExam: (id: string) =>
`${exam_report}candidate/pass-new/${id}`,
}; };

View file

@ -363,37 +363,59 @@ async function downloadFileDashboard() {
} }
async function clickPassExam() { async function clickPassExam() {
try {
showLoader(); showLoader();
await http const res = await http.get(
.get(config.API.downloadPassExam(examId.value)) config.API.downloadCandidatePassExam(examId.value),
.then(async (res) => { {
const data = res.data.result; headers: {
data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`; "Content-Type": "application/pdf",
await genReport(data, data.reportName, "pdf"); Accept: "application/pdf",
}) },
.catch((e) => { responseType: "blob",
messageError($q, e); }
}) );
.finally(() => { const url = window.URL.createObjectURL(new Blob([res.data]));
const link = document.createElement("a");
link.href = url;
link.setAttribute(
"download",
`Candidate_Dashboard_${dateToISO(new Date())}` + ".pdf"
);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
} catch (error) {
messageError($q);
} finally {
hideLoader(); hideLoader();
}); }
} }
async function clickCandidateList() { async function clickCandidateList() {
try {
showLoader(); showLoader();
await http const res = await http.get(config.API.downloadCandidateExam(examId.value), {
.get(config.API.downloadCandidateExam(examId.value)) headers: {
.then(async (res) => { "Content-Type": "application/pdf",
const data = res.data.result; Accept: "application/pdf",
data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`; },
await genReport(data, data.reportName, "pdf"); responseType: "blob",
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
const url = window.URL.createObjectURL(new Blob([res.data]));
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "รายชื่อผู้มีสิทธิ์สอบ" + ".pdf");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
} catch (error) {
messageError($q);
} finally {
hideLoader();
}
} }
async function onCheckShowExaminfo() { async function onCheckShowExaminfo() {

View file

@ -570,7 +570,7 @@ function handleDeleteNotification() {
showLoader(); showLoader();
await http.delete(config.API.msgNotificate); await http.delete(config.API.msgNotificate);
await getDataNotification(1, "DEL"); await getDataNotification(1, "DEL");
success($q, "ล้างการแจ้งสำเร็จ"); success($q, "ล้างการแจ้งสำเร็จ");
} catch (error) { } catch (error) {
messageError($q, error); messageError($q, error);
} finally { } finally {