refactor(qualify): replace api CandidateExam
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m50s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m50s
This commit is contained in:
parent
16c21467e4
commit
fd665b8b4d
3 changed files with 54 additions and 29 deletions
|
|
@ -98,6 +98,9 @@ export default {
|
|||
`${env.API_URI}/placement/candidate/pdf/${candidateId}`,
|
||||
|
||||
downloadCandidateExam: (id: string) =>
|
||||
`${periodExam}download/candidate-exam/${id}`,
|
||||
`${exam_report}candidate/candidate-new/${id}`,
|
||||
downloadPassExam: (id: string) => `${periodExam}download/pass-exam/${id}`,
|
||||
|
||||
downloadCandidatePassExam: (id: string) =>
|
||||
`${exam_report}candidate/pass-new/${id}`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ function handleDeleteNotification() {
|
|||
showLoader();
|
||||
await http.delete(config.API.msgNotificate);
|
||||
await getDataNotification(1, "DEL");
|
||||
success($q, "รล้างการแจ้งสำเร็จ");
|
||||
success($q, "ล้างการแจ้งสำเร็จ");
|
||||
} catch (error) {
|
||||
messageError($q, error);
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue