import { API_URL } from '../env'; import { getToken } from './token'; export async function agregarSubGrupo(grupoId: number, childGroupId: number): Promise { const response = await fetch(`${API_URL}/grupos/${grupoId}/subgrupos`, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${getToken()}` }, body: JSON.stringify({ child_group_id: childGroupId }) }); if (!response.ok) { const error = await response.json().catch(() => ({ message: 'Error desconocido' })); throw new Error(error.message || 'Error al agregar subgrupo'); } }