diff --git a/src/views/WorkerDashboardView.vue b/src/views/WorkerDashboardView.vue index e6fba47..d181889 100644 --- a/src/views/WorkerDashboardView.vue +++ b/src/views/WorkerDashboardView.vue @@ -32,13 +32,13 @@ 📷 Scan to Clock {{ isClockedIn ? 'Out' : 'In' }} - + --> @@ -166,8 +166,8 @@ const startScanner = () => { html5QrCode = new Html5Qrcode('qr-reader') const config = { fps: 10, qrbox: { width: 250, height: 250 } } html5QrCode.start({ facingMode: 'environment' }, config, onScanSuccess, onScanFailure) - } catch (err) { - errorMessage.value = `Unable to start camera. Try uploading an image instead. Error: ${err.message}` + } catch { + errorMessage.value = `Unable to start camera. ` isScannerActive.value = false } }, 300) @@ -179,7 +179,7 @@ const stopScanner = () => { } isScannerActive.value = false } -const triggerFileUpload = () => fileInput.value.click() +// const triggerFileUpload = () => fileInput.value.click() const handleFileUpload = (event) => { const file = event.target.files[0] if (!file) return @@ -190,8 +190,8 @@ const handleFileUpload = (event) => { html5QrCode .scanFile(file, true) .then(onScanSuccess) - .catch((err) => { - onScanFailure(`Error scanning file: ${err}`) + .catch(() => { + onScanFailure(`Try Again`) }) } const onScanSuccess = (decodedText) => { @@ -207,8 +207,8 @@ const onScanSuccess = (decodedText) => { (errorMessage.value = `Unable to retrieve your location: ${geoError.message}. Please enable location services.`), ) } -const onScanFailure = (message = 'Could not detect a QR code. Please try again.') => { - errorMessage.value = message +const onScanFailure = () => { + errorMessage.value = 'Could not detect a QR code. Please try again.' }