From d9445f72e3353d6b7d072c9a8add59a9447311b1 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Wed, 26 Mar 2025 09:31:47 +0100 Subject: [PATCH] Acortar codigo --- src/pages/Admin/ConnectionsView.vue | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/pages/Admin/ConnectionsView.vue b/src/pages/Admin/ConnectionsView.vue index c5171edd..1dcf4cee 100644 --- a/src/pages/Admin/ConnectionsView.vue +++ b/src/pages/Admin/ConnectionsView.vue @@ -72,22 +72,14 @@ const getConnections = async () => { return; } - const formattedConnections = data - .map(connection => { - const { visitUser = {}, ...rest } = connection; - - const { visitAccess, user, stamp } = visitUser; - const { visitAgent } = visitAccess || {}; - - return { - ...rest, - user, - stamp, - visitAgent - }; - }) - .filter(connection => connection.user); - connections.value = formattedConnections; + connections.value = data + .map(({ visitUser = {}, ...rest }) => ({ + ...rest, + user: visitUser.user, + stamp: visitUser.stamp, + visitAgent: visitUser.visitAccess?.visitAgent + })) + .filter(({ user }) => user); } catch (error) { console.error('Error getting connections:', error); } finally {