recibir la imagen en la api corectamente

This commit is contained in:
2025-07-30 13:47:13 -04:00
parent a15505ff2c
commit 339ce85e46
13 changed files with 493 additions and 37 deletions

View File

@@ -4,6 +4,7 @@ import {
ApiResponseSchema,
InventoryTable,
productMutate,
test,
// editInventory,
productApiResponseSchema,
getProduct
@@ -138,6 +139,36 @@ export const createProductAction = async (payload: InventoryTable) => {
return payloadWithoutId;
};
export const updateUserAction2 = async (payload: InventoryTable) => {
try {
// const { id, urlImg, ...payloadWithoutId } = payload;
// const formData = new FormData();
// formData.append('file', urlImg);
// console.log(formData);
const [error, data] = await safeFetchApi(
test,
`/pictures/upload`,
'POST',
payload,
);
if (error) {
console.error(error);
throw new Error(error?.message || 'Error al actualizar el producto');
}
// console.log(data);
return data;
} catch (error) {
console.error(error);
}
}
export const updateUserAction = async (payload: InventoryTable) => {
try {
const { id, ...payloadWithoutId } = payload;