From c0ea55f77ce21da4f27b967f639423976960997a Mon Sep 17 00:00:00 2001 From: Louis Mazin Date: Sat, 19 Sep 2026 23:24:15 +0200 Subject: [PATCH] fix --- frontend/src/pages/AdminUsersPage.jsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/AdminUsersPage.jsx b/frontend/src/pages/AdminUsersPage.jsx index 1d2ad7d..dd6a2d1 100644 --- a/frontend/src/pages/AdminUsersPage.jsx +++ b/frontend/src/pages/AdminUsersPage.jsx @@ -49,7 +49,24 @@ const AdminUsersPage = () => { console.error(error); } }; + const getUserId = (user) => { + if (!user) return ''; + if (typeof user === 'number') return String(user); + if (typeof user === 'string') { + return /^\d+$/.test(user) ? user : ''; + } + + return String( + user.id ?? + user.pk ?? + user.user_id ?? + user.userId ?? + user.user?.id ?? + user.user?.pk ?? + '' + ); + }; const copyToClipboard = () => { if (inviteLink) { navigator.clipboard.writeText(inviteLink).then(() => { @@ -83,7 +100,7 @@ const AdminUsersPage = () => { try { await userApi.deleteUser(userId); setUsers(users.filter(user => user.id !== userId)); - if(userId===currentUser.id){ + if(userId===getUserId(currentUser)){ logout(); } } catch (err) {