feat: Introduce a dedicated logout page for consistent token and session invalidation across the application.
This commit is contained in:
30
src/app/logout/page.tsx
Normal file
30
src/app/logout/page.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { signOut } from 'next-auth/react';
|
||||
|
||||
export default function LogoutPage() {
|
||||
useEffect(() => {
|
||||
// Clear localStorage tokens
|
||||
localStorage.removeItem('accessToken');
|
||||
localStorage.removeItem('refreshToken');
|
||||
localStorage.removeItem('user');
|
||||
|
||||
// Sign out via NextAuth (clears session cookie) and redirect to login
|
||||
signOut({ callbackUrl: '/login', redirect: true });
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-white">
|
||||
<div className="text-center">
|
||||
<div className="w-12 h-12 border-4 border-[#e58625] border-t-transparent rounded-full animate-spin mx-auto mb-6" />
|
||||
<h1 className="font-fractul font-bold text-[24px] text-[#00293D] mb-2">
|
||||
Signing Out
|
||||
</h1>
|
||||
<p className="font-serif text-[14px] text-[#00293D]/60">
|
||||
Please wait while we securely log you out...
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user