Update AuthScreen.tsx
This commit is contained in:
@@ -4,8 +4,8 @@ import { Lock, User, Mail, Briefcase, ArrowRight, AlertCircle } from 'lucide-rea
|
|||||||
|
|
||||||
interface AuthScreenProps {
|
interface AuthScreenProps {
|
||||||
settings: AppSettings;
|
settings: AppSettings;
|
||||||
onClientLogin: (email: string, password: string) => boolean;
|
onClientLogin: (email: string, password: string) => Promise<boolean>;
|
||||||
onAgentLogin: (email: string, password: string) => boolean;
|
onAgentLogin: (email: string, password: string) => Promise<boolean>;
|
||||||
onClientRegister: (name: string, email: string, password: string, company: string) => void;
|
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 [name, setName] = useState('');
|
||||||
const [company, setCompany] = useState('');
|
const [company, setCompany] = useState('');
|
||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setError(null);
|
setError(null);
|
||||||
let success = false;
|
let success = false;
|
||||||
|
|
||||||
if (activeTab === 'agent') {
|
if (activeTab === 'agent') {
|
||||||
success = onAgentLogin(email, password);
|
success = await onAgentLogin(email, password);
|
||||||
} else {
|
} else {
|
||||||
if (isRegistering) {
|
if (isRegistering) {
|
||||||
onClientRegister(name, email, password, company);
|
onClientRegister(name, email, password, company);
|
||||||
success = true; // Assume success for mock registration
|
success = true; // Assume success for mock registration
|
||||||
} else {
|
} else {
|
||||||
success = onClientLogin(email, password);
|
success = await onClientLogin(email, password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user