feat: hecha interfaz y hooks para clientes

Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
fede committed 2026-11-19 08:59:20 -03:00
1 parent 1948f1f426
commit d9b76701e9
10 files changed
+557

No files matched your search

@@ -0,0 +1,18 @@
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';
}
}