From 1abdd974dc5fc79e3178d5a64a65df65467b7831 Mon Sep 17 00:00:00 2001 From: Ezra Khairan Permana Date: Fri, 13 Oct 2023 12:38:40 +0700 Subject: [PATCH] feat: menambahkan kemudahan untuk attendance --- .../src/components/PreScan/ErrorOccured.tsx | 2 +- .../src/components/Scanner/NormalScanner.tsx | 13 ++++++------- .../src/components/Scanner/ScanningError.tsx | 8 +++++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/apps/desktop/attendance/src/renderer/src/components/PreScan/ErrorOccured.tsx b/apps/desktop/attendance/src/renderer/src/components/PreScan/ErrorOccured.tsx index ce74d5f8..346e1ed2 100644 --- a/apps/desktop/attendance/src/renderer/src/components/PreScan/ErrorOccured.tsx +++ b/apps/desktop/attendance/src/renderer/src/components/PreScan/ErrorOccured.tsx @@ -16,7 +16,7 @@ const ErrorOcurred: React.FC = () => { alignItems="center" justifyContent="center" > - + location.reload()}> Terjadi Kesalahan Internal diff --git a/apps/desktop/attendance/src/renderer/src/components/Scanner/NormalScanner.tsx b/apps/desktop/attendance/src/renderer/src/components/Scanner/NormalScanner.tsx index 6ba30b70..05564d38 100644 --- a/apps/desktop/attendance/src/renderer/src/components/Scanner/NormalScanner.tsx +++ b/apps/desktop/attendance/src/renderer/src/components/Scanner/NormalScanner.tsx @@ -24,16 +24,15 @@ const NormalScanner = ({ const qrScanner = new QrScanner( videoRef.current, ({ data }) => { - // Bug from QR Scanner - if (!data || data === "") return; + if (data || data !== "") { + qrScanner.stop(); - qrScanner.stop(); + const isValidQr = validateId(data); - const isValidQr = validateId(data); + if (!isValidQr) return setInvalidQr(true); - if (!isValidQr) return setInvalidQr(true); - - participantAttend.mutate(data); + participantAttend.mutate(data); + } }, { highlightCodeOutline: true, diff --git a/apps/desktop/attendance/src/renderer/src/components/Scanner/ScanningError.tsx b/apps/desktop/attendance/src/renderer/src/components/Scanner/ScanningError.tsx index b64b6d40..4af33c5a 100644 --- a/apps/desktop/attendance/src/renderer/src/components/Scanner/ScanningError.tsx +++ b/apps/desktop/attendance/src/renderer/src/components/Scanner/ScanningError.tsx @@ -18,7 +18,13 @@ const ScanningError = ({ message }: { message: string }) => { justifyContent="center" flexDirection="column" > - + location.reload()} + > Gagal Absen!