A sleek React.js application that allows users to log in using DummyJSON credentials and view a responsive list of products with search, sorting, and secure JWT authentication. Itβs built with modern React practices, Tailwind CSS, and toast notifications for a clean UI/UX.
π Login β View Products β Auto Logout on Token Expiry
π https://prodview.vercel.app (replace with your deployment URL)
- βοΈ React 18+
- π¨ Tailwind CSS
- π React Router
- π JWT Authentication
- π React Toastify
- π Axios
- β‘ Vite
- ποΈ Context API
- Login with DummyJSON test credentials
- JWT token stored securely in localStorage
- Auto logout on token expiry
- Session checked every minute
- Toast notifications for login/logout/session
- Fetch products from DummyJSON API
- Display name, image, price & rating
- Loading state while fetching
- Fully responsive grid layout
- Search by product title
- Sort by price, rating, or name (if implemented)
{
"username": "kminchelle",
"password": "0lelplR"
}
π οΈ Getting Started 1οΈβ£ Clone the Repository
git clone https://github.com/your-username/prodview.git
cd prodview 2οΈβ£ Install Dependencies npm install
3οΈβ£ Create .env File VITE_API=https://dummyjson.com You can also create .env.example for sharing in GitHub.
4οΈβ£ Start the Dev Server npm run dev Navigate to http://localhost:5173
π§ How It Works On login, token is stored in localStorage
Every 60 seconds, we check if token is expired
If expired β auto logout + toast + redirect to /
All routes are protected using AuthContext
π APIs Used π Login API - POST: https://dummyjson.com/auth/login π Products API - GET: https://dummyjson.com/products
πΈ Screenshots (Optional) Login Page Product Listing
π License This project is licensed under the MIT License.
πββοΈ Author Made with β€οΈ by Syed Faisal Abdul Rahman Zulfequar