fix sync usr to admin & fix notification plate & Rut Validation

This commit is contained in:
2025-12-28 21:16:59 -03:00
parent 522b885dfe
commit fbcf7fb9c8
3 changed files with 90 additions and 3 deletions

View File

@@ -23,7 +23,15 @@ function UserDashboard({ token, username }) {
setDetections(prev => [data, ...prev].slice(0, 5));
});
return () => socket.off('new_detection');
// Real-time status updates
socket.on('plate_status_updated', () => fetchPlates());
socket.on('people_updated', () => fetchPeople());
return () => {
socket.off('new_detection');
socket.off('plate_status_updated');
socket.off('people_updated');
};
}, [token]);
const fetchPlates = async () => {
@@ -62,7 +70,7 @@ function UserDashboard({ token, username }) {
});
setNewPlate({ number: '', owner: '' });
fetchPlates();
alert('Plate registered! Waiting for admin approval.');
// Alert removed for better UX
} catch (err) {
alert('Error: ' + err.message);
}