diff --git a/src/private/AddProductForm.jsx b/src/private/AddProductForm.jsx index 27e961d..ae25d96 100644 --- a/src/private/AddProductForm.jsx +++ b/src/private/AddProductForm.jsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { Box, Button, TextField, Typography, Grid } from '@mui/material'; -export default function AddProductForm() { +export default function AddProductForm({ onAdd }) { const [product, setProduct] = useState({ name: '', price: '', @@ -15,8 +15,11 @@ export default function AddProductForm() { setProduct((prev) => ({ ...prev, [name]: value })); }; - const handleSave = () => { - console.log('Saving product:', product); + const handleSave = () => { + if (onAdd) { + onAdd(product); + setProduct({ name: '', price: '', provider: '', stock: '', category: '' }); + } }; const handleDelete = () => { diff --git a/src/private/Admin.jsx b/src/private/Admin.jsx index 31bdc46..48508f5 100644 --- a/src/private/Admin.jsx +++ b/src/private/Admin.jsx @@ -50,7 +50,6 @@ export default function Admin({ children, maxWidth = 'lg', sx = {} }) { -