nice
This commit is contained in:
parent
b54bbd018a
commit
dee38ad8dc
@ -120,8 +120,15 @@ const TimeClockPage = () => {
|
||||
};
|
||||
|
||||
const stopScanner = () => {
|
||||
qrControlsRef.current?.stop();
|
||||
const controls = qrControlsRef.current;
|
||||
qrControlsRef.current = null;
|
||||
|
||||
try {
|
||||
controls?.stop();
|
||||
} catch (stopError) {
|
||||
console.warn('Arrêt du lecteur QR déjà effectué.', stopError);
|
||||
}
|
||||
|
||||
if (scanFrameRef.current) {
|
||||
cancelAnimationFrame(scanFrameRef.current);
|
||||
scanFrameRef.current = null;
|
||||
@ -156,7 +163,11 @@ const TimeClockPage = () => {
|
||||
);
|
||||
|
||||
if (cancelled) {
|
||||
controls.stop();
|
||||
try {
|
||||
controls.stop();
|
||||
} catch (stopError) {
|
||||
console.warn('Arrêt du lecteur QR déjà effectué.', stopError);
|
||||
}
|
||||
} else {
|
||||
qrControlsRef.current = controls;
|
||||
}
|
||||
@ -173,7 +184,11 @@ const TimeClockPage = () => {
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
reader.reset();
|
||||
try {
|
||||
reader.reset();
|
||||
} catch (resetError) {
|
||||
console.warn('Réinitialisation du lecteur QR ignorée.', resetError);
|
||||
}
|
||||
};
|
||||
}, [isScanning]);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user