Overview
Tienda ETCA implements a role-based authentication system that distinguishes between two user types:- Admin: Full access to product management and administrative features
- Cliente: Standard client access to browse and purchase products
User Roles
The system supports two distinct roles:AuthContext Implementation
The authentication logic is centralized inAuthContext.jsx located at ~/workspace/source/src/context/AuthContext.jsx:1.
State Management
Session Persistence
The system checks for existing sessions on mount:Authentication state persists across page refreshes using localStorage.
Login Flow
The authentication flow is handled in~/workspace/source/src/context/AuthContext.jsx:31-71:
1. Form Validation
2. User Authentication
Login Component
The Login UI component is located at~/workspace/source/src/layout/Login.jsx:1:
Using the Auth Hook
Access authentication state anywhere in your app:Context Provider
The AuthContext provides the following values:Wrap your app with
AuthProvider to enable authentication throughout the component tree.