feat: Centralize authentication redirects to middleware, remove client-side redirect logic, and refine logout process.
This commit is contained in:
@@ -4,6 +4,7 @@ import { useState } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { signIn } from 'next-auth/react';
|
||||
import Link from 'next/link';
|
||||
import { resetLogoutState } from '@/services/api';
|
||||
|
||||
export default function LoginPage() {
|
||||
const router = useRouter();
|
||||
@@ -13,9 +14,12 @@ export default function LoginPage() {
|
||||
const [error, setError] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
// Safety net: clear logout flag when login page loads
|
||||
// Safety net: clear logout flags when login page loads.
|
||||
// This resets both the localStorage flag and the module-level flag in api.ts
|
||||
// so the API interceptor stops blocking requests.
|
||||
if (typeof window !== 'undefined') {
|
||||
localStorage.removeItem('isLoggingOut');
|
||||
resetLogoutState();
|
||||
}
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
|
||||
Reference in New Issue
Block a user