+
+
diff --git a/components/Form.js b/components/Form.js
index c639edd..11739f6 100644
--- a/components/Form.js
+++ b/components/Form.js
@@ -2,10 +2,10 @@ const PDFJS = require('pdfjs-dist')
PDFJS.GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${PDFJS.version}/pdf.worker.js`
import jsQR from "jsqr"
-import { saveAs } from 'file-saver'
+import {saveAs} from 'file-saver'
-import { decodeData } from "../src/decode"
-import { createPass } from "../src/pass"
+import {decodeData} from "../src/decode"
+import {createPass} from "../src/pass"
import Card from "../components/Card"
import Alert from "../components/Alert"
@@ -43,12 +43,12 @@ function Form() {
const file = document.getElementById('pdf').files[0]
const result = await readFileAsync(file)
- var typedarray = new Uint8Array(result)
+ let typedArray = new Uint8Array(result)
const canvas = document.getElementById('canvas')
const ctx = canvas.getContext('2d')
- var loadingTask = PDFJS.getDocument(typedarray)
+ let loadingTask = PDFJS.getDocument(typedArray)
await loadingTask.promise.then(async function (pdfDocument) {
const pdfPage = await pdfDocument.getPage(1)
const viewport = pdfPage.getViewport({ scale: 1 })
@@ -63,8 +63,8 @@ function Form() {
return await renderTask.promise
})
- var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height)
- var code = jsQR(imageData.data, imageData.width, imageData.height, {
+ let imageData = ctx.getImageData(0, 0, canvas.width, canvas.height)
+ let code = jsQR(imageData.data, imageData.width, imageData.height, {
inversionAttempts: 'dontInvert',
})
@@ -78,9 +78,7 @@ function Form() {
error('Invalid QR code found', 'Make sure that you picked the correct PDF')
}
- const result = { decoded: decoded, raw: rawData }
-
- return result
+ return {decoded: decoded, raw: rawData}
} else {
error('No QR code found', 'Try scanning the PDF again')
}
@@ -119,7 +117,7 @@ function Form() {
saveAs(passBlob, 'covid.pkpass')
}
} catch (e) {
- error('Error:', error.message)
+ error('Error:', e.message)
} finally {
document.getElementById('spin').style.display = 'none'
}
@@ -155,7 +153,7 @@ function Form() {
} />
@@ -177,8 +175,8 @@ function Form() {