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