Skip to content

Commit

Permalink
Merge pull request #1046 from samarthgr/DIV-8403
Browse files Browse the repository at this point in the history
DIV-8403 | updating GET EU cert API in public-app
  • Loading branch information
egov-joy authored Apr 6, 2022
2 parents 6c00bb5 + cde4636 commit a86c915
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion public_app/src/components/CertificateView/CertificateView.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,16 @@ function CertificateView() {
}

function downloadAsEUCertificate() {
axios.get(`/certificate/api/eu-certificate?refId=${certificateData.preEnrollmentCode}`, {...config, responseType: 'blob'})
const fullName = certificateData.name.trim();
const lastName = fullName.substring(fullName.lastIndexOf(" ")+1)
const firstName = fullName.substring(0,(fullName.length - lastName.length)).trim();
const requestBody = {
"fn": firstName,
"fnt": "TRANSLATED>GIVEN>NAME",
"gn": lastName,
"gnt": "TRANSLATED>LAST>NAME",
}
axios.post(`/certificate/api/eu-certificate?refId=${certificateData.preEnrollmentCode}`, requestBody, {...config, responseType: 'blob'})
.then((blob) => {
const file = new Blob([blob.data], {type: 'application/pdf'});
var url = URL.createObjectURL(file);
Expand Down

0 comments on commit a86c915

Please sign in to comment.