Guardar y cambiar img al editar productos

This commit is contained in:
2025-08-12 15:58:32 -04:00
parent 8a54bf7138
commit 854b31f594
20 changed files with 162 additions and 50 deletions

View File

@@ -64,7 +64,7 @@ export const getAllProducts = async (params: {
sortOrder?: 'asc' | 'desc';
}) => {
const session = await auth()
// const session = await auth()
const searchParams = new URLSearchParams({
page: (params.page || 1).toString(),
@@ -74,7 +74,7 @@ export const getAllProducts = async (params: {
...(params.sortOrder && { sortOrder: params.sortOrder }),
})
const id = session?.user.id
// const id = session?.user.id
const [error, response] = await safeFetchApi(
productApiResponseSchema,
@@ -152,8 +152,8 @@ export const updateUserAction2 = async (payload: InventoryTable) => {
const [error, data] = await safeFetchApi(
test,
`/pictures/upload`,
'POST',
`/products/upload`,
'PATCH',
payload,
);
@@ -161,7 +161,7 @@ export const updateUserAction2 = async (payload: InventoryTable) => {
console.error(error);
throw new Error(error?.message || 'Error al actualizar el producto');
}
// console.log(data);
console.log(data);
return data;
} catch (error) {