cambios en el crear producto y en el refresh token
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user