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

@ -363,37 +363,59 @@ async function downloadFileDashboard() {
}
async function clickPassExam() {
showLoader();
await http
.get(config.API.downloadPassExam(examId.value))
.then(async (res) => {
const data = res.data.result;
data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`;
await genReport(data, data.reportName, "pdf");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
try {
showLoader();
const res = await http.get(
config.API.downloadCandidatePassExam(examId.value),
{
headers: {
"Content-Type": "application/pdf",
Accept: "application/pdf",
},
responseType: "blob",
}
);
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();
}
}
async function clickCandidateList() {
showLoader();
await http
.get(config.API.downloadCandidateExam(examId.value))
.then(async (res) => {
const data = res.data.result;
data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`;
await genReport(data, data.reportName, "pdf");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
try {
showLoader();
const res = await http.get(config.API.downloadCandidateExam(examId.value), {
headers: {
"Content-Type": "application/pdf",
Accept: "application/pdf",
},
responseType: "blob",
});
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() {