fix: evitar chamadas de status do socket para nao-admins e usar fetchWithAuth
continuous-integration/webhook Deploy concluido (rx.scoreodonto.com)
continuous-integration/webhook Deploy concluido (rx.scoreodonto.com)
This commit is contained in:
@@ -241,9 +241,16 @@ function setupEventListeners() {
|
||||
|
||||
async function loadClientsList() {
|
||||
try {
|
||||
const r = await fetch('/api/socket/status');
|
||||
const data = await r.json();
|
||||
clientsList = (data.identified || []).map(c => ({
|
||||
let identified = [];
|
||||
const isAdmin = localStorage.getItem('is_admin') === 'true';
|
||||
if (isAdmin) {
|
||||
const r = await fetchWithAuth('/api/socket/status');
|
||||
if (r.ok) {
|
||||
const data = await r.json();
|
||||
identified = data.identified || [];
|
||||
}
|
||||
}
|
||||
clientsList = identified.map(c => ({
|
||||
...c, name: c.name || 'Unknown', displayName: c.name || 'Unknown',
|
||||
dbName: c.name || 'Unknown', status: 'identified'
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user