This commit is contained in:
Andras Schmelczer 2026-05-14 20:42:48 +01:00
parent 273d7a83ee
commit 084117cea8
48 changed files with 2283 additions and 890 deletions

View file

@ -8,6 +8,7 @@ type View = 'login' | 'register' | 'forgot';
export default function AuthModal({
onClose,
onAuthenticated,
onLogin,
onRegister,
onOAuthLogin,
@ -18,6 +19,7 @@ export default function AuthModal({
initialTab = 'login',
}: {
onClose: () => void;
onAuthenticated?: () => void;
onLogin: (email: string, password: string) => Promise<void>;
onRegister: (email: string, password: string) => Promise<void>;
onOAuthLogin: (provider: string) => Promise<void>;
@ -52,9 +54,11 @@ export default function AuthModal({
try {
if (view === 'login') {
await onLogin(email, password);
onAuthenticated?.();
onClose();
} else if (view === 'register') {
await onRegister(email, password);
onAuthenticated?.();
onClose();
} else {
await onForgotPassword(email);
@ -64,19 +68,20 @@ export default function AuthModal({
// Error is handled by the hook
}
},
[view, email, password, onLogin, onRegister, onForgotPassword, onClose]
[view, email, password, onLogin, onRegister, onForgotPassword, onAuthenticated, onClose]
);
const handleOAuth = useCallback(
async (provider: string) => {
try {
await onOAuthLogin(provider);
onAuthenticated?.();
onClose();
} catch {
// Error is handled by the hook
}
},
[onOAuthLogin, onClose]
[onOAuthLogin, onAuthenticated, onClose]
);
const title =