feat: Introduce Nginx development configuration and enhance authentication state management by refining logout flag handling and session restoration conditions.
This commit is contained in:
@@ -15,19 +15,15 @@ export default function LoginPage() {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [userType, setUserType] = useState<'USER' | 'ADMIN'>('USER');
|
||||
|
||||
// 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) => {
|
||||
e.preventDefault();
|
||||
setLoading(true);
|
||||
setError('');
|
||||
|
||||
// Clear logout flags now that user is actively logging in
|
||||
localStorage.removeItem('isLoggingOut');
|
||||
resetLogoutState();
|
||||
|
||||
try {
|
||||
// First, validate credentials with backend to get proper error messages
|
||||
const validateRes = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/login`, {
|
||||
|
||||
Reference in New Issue
Block a user