Update AuthScreen.tsx

This commit is contained in:
fcarraUniSa
2026-02-17 10:09:12 +01:00
committed by GitHub
parent 5e03390716
commit 256c4e303b

View File

@@ -4,8 +4,8 @@ import { Lock, User, Mail, Briefcase, ArrowRight, AlertCircle } from 'lucide-rea
interface AuthScreenProps {
settings: AppSettings;
onClientLogin: (email: string, password: string) => boolean;
onAgentLogin: (email: string, password: string) => boolean;
onClientLogin: (email: string, password: string) => Promise<boolean>;
onAgentLogin: (email: string, password: string) => Promise<boolean>;
onClientRegister: (name: string, email: string, password: string, company: string) => void;
}
@@ -20,19 +20,19 @@ export const AuthScreen: React.FC<AuthScreenProps> = ({ settings, onClientLogin,
const [name, setName] = useState('');
const [company, setCompany] = useState('');
const handleSubmit = (e: React.FormEvent) => {
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
setError(null);
let success = false;
if (activeTab === 'agent') {
success = onAgentLogin(email, password);
success = await onAgentLogin(email, password);
} else {
if (isRegistering) {
onClientRegister(name, email, password, company);
success = true; // Assume success for mock registration
} else {
success = onClientLogin(email, password);
success = await onClientLogin(email, password);
}
}