import { API_URL } from '$lib/env'; import { getToken } from '../token'; export async function eliminarCliente(id: number) { try { const req = await fetch(`${API_URL}/clientes/${id}`, { method: 'DELETE', headers: { Authorization: `Bearer ${getToken()}` } }); if (req.ok) return 'Ok'; const data = await req.json(); return data.error ?? 'No se pudo eliminar el cliente'; } catch { return 'No se pudo alcanzar el servidor'; } }