cambios en el crear producto y en el refresh token

This commit is contained in:
2025-08-14 15:38:10 -04:00
parent 854b31f594
commit 6a28e141a9
19 changed files with 278 additions and 400 deletions

View File

@@ -117,18 +117,19 @@ export const getProductById = async (id: number) => {
return data;
};
export const createProductAction = async (payload: InventoryTable) => {
export const createProductAction = async (payload: FormData) => {
const session = await auth()
const userId = session?.user?.id
const { id, ...payloadWithoutId } = payload;
payloadWithoutId.userId = userId
if (userId) {
payload.append('userId', String(userId));
}
const [error, data] = await safeFetchApi(
productMutate,
'/products',
'POST',
payloadWithoutId,
payload,
);
if (error) {
@@ -136,7 +137,7 @@ export const createProductAction = async (payload: InventoryTable) => {
throw new Error('Error al crear el producto');
}
return payloadWithoutId;
return data;
};
export const updateUserAction2 = async (payload: InventoryTable) => {