From f9f841e4f1b5b951d55cf22a5f5ebe3601e20488 Mon Sep 17 00:00:00 2001 From: raven Date: Sat, 3 Jan 2026 12:56:47 -0300 Subject: [PATCH] fix update status plate user --- frontend/src/pages/UserDashboard.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/UserDashboard.jsx b/frontend/src/pages/UserDashboard.jsx index f5a83f1..6ba2d50 100644 --- a/frontend/src/pages/UserDashboard.jsx +++ b/frontend/src/pages/UserDashboard.jsx @@ -24,11 +24,13 @@ function UserDashboard({ token, username }) { }); // Real-time status updates + socket.on('new_plate_registered', () => fetchPlates()); // Sync when plate added socket.on('plate_status_updated', () => fetchPlates()); socket.on('people_updated', () => fetchPeople()); return () => { socket.off('new_detection'); + socket.off('new_plate_registered'); socket.off('plate_status_updated'); socket.off('people_updated'); }; @@ -39,10 +41,8 @@ function UserDashboard({ token, username }) { const res = await axios.get(`${API_URL}/api/plates`, { headers: { Authorization: `Bearer ${token}` } }); - // Filter plates added by this user (if backend doesn't filter, we filter here) - // Note: Backend currently returns ALL plates. We can filter on client for now. - const myPlates = res.data.filter(p => p.addedBy?.username === username); - setPlates(myPlates); + // Backend already filters by user, so use data directly + setPlates(res.data); } catch (err) { console.error(err); } @@ -241,7 +241,7 @@ function UserDashboard({ token, username }) {
{p.status}