The product management system provides full CRUD operations through theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/betovildoza/tiendaetca/llms.txt
Use this file to discover all available pages before exploring further.
AdminContext and modal-based forms. All operations interact with a MockAPI backend.
API Configuration
The admin panel connects to MockAPI for product data:/workspace/source/src/context/AdminContext.jsx:12
Product Data Structure
Products contain the following fields:Auto-generated product identifier
Product name
Product price (must be greater than 0)
Product description (minimum 10 characters)
Available stock quantity
URL to product image
Product category
Adding Products
Opening the Add Form
Click the “Abrir panel agregar producto” button to open theFormularioProducto modal:
/workspace/source/src/layout/Admin.jsx:61
Form Validation
The add form includes validation rules:/workspace/source/src/components/FormularioProducto.jsx:17-25
API Call: POST Request
When the form is submitted, theagregarProducto function sends a POST request:
/workspace/source/src/context/AdminContext.jsx:30-54
After adding a product,
cargarProductos() is called to refresh the product list.Editing Products
Opening the Edit Form
Click the “Editar” button on any product card:/workspace/source/src/layout/Admin.jsx:50-53
This opens the FormularioEdicion modal with the selected product data pre-filled.
Edit Form Fields
The edit form (FormularioEdicion) includes all product fields:
- ID (read-only)
- Nombre (text input)
- Precio (number input, min: 0)
- Stock (number input)
- Imagen (text input for URL)
- Categoría (text input)
- Descripción (textarea)
/workspace/source/src/components/FormularioEdicion.jsx:35-124
API Call: PUT Request
TheactualizarProducto function sends a PUT request:
/workspace/source/src/context/AdminContext.jsx:101-126
Deleting Products
Triggering Delete
Click the “Eliminar” button on any product card:/workspace/source/src/layout/Admin.jsx:54
Confirmation Dialog
Before deleting, a SweetAlert2 confirmation dialog appears:/workspace/source/src/context/AdminContext.jsx:70-76
API Call: DELETE Request
If confirmed, a DELETE request is sent:/workspace/source/src/context/AdminContext.jsx:78-99
Loading Products
Products are loaded automatically when theAdminContext mounts:
/workspace/source/src/context/AdminContext.jsx:14-28
A 2-second delay is added to simulate loading time and show the loading state.
Reload Function
After any CRUD operation, products are reloaded:/workspace/source/src/context/AdminContext.jsx:56-64
User Feedback
All operations use SweetAlert2 for user feedback:Success
Shown after successful add, edit, or delete
Error
Shown when operations fail
Warning
Shown before delete confirmation