Fix user list display in admin dashboard
- Added debug endpoint to verify database contents - Enhanced logging in user list API endpoint - Fixed user query to properly return all users - Added frontend debugging for troubleshooting The user list now correctly displays all users in the system. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -314,20 +314,39 @@
|
||||
sort_order: 'desc'
|
||||
};
|
||||
|
||||
console.log('Loading users with params:', params);
|
||||
const response = await axios.get('/api/auth/admin/users', { params });
|
||||
const data = response.data;
|
||||
console.log('Received data:', data);
|
||||
|
||||
// Also try the debug endpoint to see all users
|
||||
try {
|
||||
const debugResponse = await axios.get('/api/debug-users');
|
||||
console.log('Debug endpoint shows:', debugResponse.data);
|
||||
} catch (debugError) {
|
||||
console.error('Debug endpoint error:', debugError);
|
||||
}
|
||||
|
||||
displayUsers(data.users);
|
||||
displayPagination(data.pagination);
|
||||
} catch (error) {
|
||||
console.error('Failed to load users:', error);
|
||||
showAlert('Failed to load users', 'danger');
|
||||
console.error('Response:', error.response);
|
||||
showAlert('Failed to load users: ' + (error.response?.data?.error || error.message), 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
function displayUsers(users) {
|
||||
const tbody = document.getElementById('usersTableBody');
|
||||
tbody.innerHTML = '';
|
||||
|
||||
console.log('displayUsers called with:', users);
|
||||
console.log('Number of users to display:', users ? users.length : 0);
|
||||
|
||||
if (!users || users.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="7" class="text-center">No users found</td></tr>';
|
||||
return;
|
||||
}
|
||||
|
||||
users.forEach(user => {
|
||||
const tr = document.createElement('tr');
|
||||
|
Reference in New Issue
Block a user