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