async function getUserList(q, token) { if (!token) { return "not_init"; } const response = await fetch(`/api/chat/users?q=${encodeURIComponent(q)}`, { method: "GET", headers: { "Authorization": `Bearer ${token}` } }); if (!response.ok) { const errorData = await response.json().catch(() => ({ message: "Respuesta no vĂ¡lida del servidor." })); throw new Error(errorData.message || `Error del servidor: ${response.status}`); } const data = await response.json(); return data.users || []; } export { getUserList };