recibir la imagen en la api corectamente
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user