Private
Public Access
feat: añadido eliminar repuestos y un modal para ver el objeto entero
This commit is contained in:
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';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user