feat: añadido eliminar repuestos y un modal para ver el objeto entero

This commit is contained in:
fede committed 2026-07-01 02:12:30 -03:00
1 parent 72790ac9a3
commit 2549b7d6ba
7 files changed
+168 -12

No files matched your search

@@ -0,0 +1,20 @@
import { API_URL } from '$lib/env';
import { getToken } from '../token';
export async function eliminarRepuesto(id: number) {
try {
const req = await fetch(`${API_URL}/repuestos/${id}`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${getToken()}`
}
});
if (req.ok) {
return 'Ok';
}
const data = await req.json();
return data.error;
} catch {
return 'no se puso alcanzar el servidor';
}
}