Cambios de nombres de variables y esquema
This commit is contained in:
@@ -118,15 +118,8 @@ export const getProductById = async (id: number) => {
|
||||
};
|
||||
|
||||
export const createProductAction = async (payload: FormData) => {
|
||||
// const session = await auth()
|
||||
// const userId = session?.user?.id
|
||||
|
||||
// if (userId) {
|
||||
// payload.append('userId', String(userId));
|
||||
// }
|
||||
|
||||
const [error, data] = await safeFetchApi(
|
||||
test,
|
||||
productMutate,
|
||||
'/products',
|
||||
'POST',
|
||||
payload,
|
||||
@@ -140,19 +133,10 @@ export const createProductAction = async (payload: FormData) => {
|
||||
return data;
|
||||
};
|
||||
|
||||
export const updateUserAction2 = async (payload: InventoryTable) => {
|
||||
try {
|
||||
// const { id, urlImg, ...payloadWithoutId } = payload;
|
||||
|
||||
// const formData = new FormData();
|
||||
// formData.append('file', urlImg);
|
||||
|
||||
|
||||
// console.log(formData);
|
||||
|
||||
|
||||
export const updateProductAction = async (payload: InventoryTable) => {
|
||||
try {
|
||||
const [error, data] = await safeFetchApi(
|
||||
test,
|
||||
productMutate,
|
||||
`/products/upload`,
|
||||
'PATCH',
|
||||
payload,
|
||||
@@ -170,27 +154,6 @@ export const updateUserAction2 = async (payload: InventoryTable) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const updateUserAction = async (payload: InventoryTable) => {
|
||||
try {
|
||||
const { id, ...payloadWithoutId } = payload;
|
||||
|
||||
const [error, data] = await safeFetchApi(
|
||||
productMutate,
|
||||
`/products/${id}`,
|
||||
'PATCH',
|
||||
payloadWithoutId,
|
||||
);
|
||||
|
||||
if (error) {
|
||||
console.error(error);
|
||||
throw new Error(error?.message || 'Error al actualizar el producto');
|
||||
}
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
export const deleteProductAction = async (id: Number) => {
|
||||
const [error] = await safeFetchApi(
|
||||
productMutate,
|
||||
|
||||
Reference in New Issue
Block a user