New chat started from template Next.js + shadcn/ui
please add mock auth
I'll add a mock authentication system to your Next.js application. This will include a simple login page, a protected dashboard, and a mock authentication context. We'll use React's Context API for state management and Next.js App Router for routing.
Let's start by creating the necessary components and context:
This setup provides a basic mock authentication system with the following features:
/login
/dashboard
To test the authentication:
/login
Remember, this is a mock authentication system and is not secure for production use. In a real application, you would want to implement proper server-side authentication and use secure methods for storing and transmitting credentials.
The code returns the following error:
Error: useAuth must be used within an AuthProvider
at useAuth (/app/contexts/AuthContext)
at LoginPage (/app/login/page)
Revise the code to address the error.