Add demo mode support with MSW integration and documentation
- Integrated Mock Service Worker (MSW) for frontend-only demo mode, allowing API call interception without requiring a backend. - Added `DemoModeBanner` component to indicate active demo mode and display demo credentials. - Enhanced configuration with `DEMO_MODE` flag and demo credentials for user and admin access. - Updated ESLint configuration to exclude MSW-related files from linting and coverage. - Created comprehensive `DEMO_MODE.md` documentation for setup and usage guidelines, including deployment instructions and troubleshooting. - Updated package dependencies to include MSW and related libraries.
This commit is contained in:
@@ -71,6 +71,7 @@ const ENV = {
|
||||
ENABLE_REGISTRATION: process.env.NEXT_PUBLIC_ENABLE_REGISTRATION,
|
||||
ENABLE_SESSION_MANAGEMENT: process.env.NEXT_PUBLIC_ENABLE_SESSION_MANAGEMENT,
|
||||
DEBUG_API: process.env.NEXT_PUBLIC_DEBUG_API,
|
||||
DEMO_MODE: process.env.NEXT_PUBLIC_DEMO_MODE,
|
||||
NODE_ENV: process.env.NODE_ENV || 'development',
|
||||
} as const;
|
||||
|
||||
@@ -118,6 +119,16 @@ export const config = {
|
||||
api: parseBool(ENV.DEBUG_API, false) && ENV.NODE_ENV === 'development',
|
||||
},
|
||||
|
||||
demo: {
|
||||
// Enable demo mode (uses Mock Service Worker instead of real backend)
|
||||
enabled: parseBool(ENV.DEMO_MODE, false),
|
||||
// Demo credentials
|
||||
credentials: {
|
||||
user: { email: 'demo@example.com', password: 'DemoPass123' },
|
||||
admin: { email: 'admin@example.com', password: 'AdminPass123' },
|
||||
},
|
||||
},
|
||||
|
||||
env: {
|
||||
isDevelopment: ENV.NODE_ENV === 'development',
|
||||
isProduction: ENV.NODE_ENV === 'production',
|
||||
|
||||
Reference in New Issue
Block a user