deckhearth/pages/logout.js
Randall Stillwell 53423509f0 Integrated real database authentication with JWT tokens
- Updated auth verification to use Neon database instead of mock data
- Implemented proper JWT token authentication with localStorage storage
- Created beautiful login page with admin quick-login for development
- Updated all admin auth hooks to use JWT tokens from localStorage
- Added automatic token cleanup on authentication failures
- Enhanced AdminProtected component with proper token validation
- Created logout functionality that clears tokens and redirects
- Maintained fallback admin access for development (no token = admin)
- Real admin credentials: admin@tcgvault.com / admin123
- Seamless integration with existing admin card editor workflow
2025-07-24 16:36:10 -05:00

36 lines
No EOL
1.1 KiB
JavaScript

import { useEffect } from 'react';
import { useRouter } from 'next/router';
import Layout from '../components/Layout';
export default function Logout() {
const router = useRouter();
useEffect(() => {
// Clear the auth token
localStorage.removeItem('auth_token');
// Redirect to login after a short delay
setTimeout(() => {
router.push('/login');
}, 2000);
}, [router]);
return (
<Layout user={null}>
<div className="min-h-screen flex items-center justify-center">
<div className="text-center">
<div className="text-6xl mb-4">👋</div>
<h2 className="text-2xl font-bold mb-2" style={{ color: 'var(--text-primary)' }}>
Signing you out...
</h2>
<p style={{ color: 'var(--text-secondary)' }}>
You will be redirected to the login page shortly.
</p>
<div className="mt-4">
<div className="animate-spin rounded-full h-8 w-8 border-b-2 mx-auto" style={{ borderColor: 'var(--text-accent)' }}></div>
</div>
</div>
</div>
</Layout>
);
}