fix: email storing
This commit is contained in:
parent
98d8e31373
commit
77006e8f47
|
|
@ -106,10 +106,9 @@ export function HeroSection() {
|
|||
}
|
||||
setIsInvalid(false);
|
||||
|
||||
const result = await submitEmail(email);
|
||||
if (result.success) {
|
||||
setShowPopup(true);
|
||||
}
|
||||
// Fire and forget - don't block popup on logging failure
|
||||
submitEmail(email).catch(console.error);
|
||||
setShowPopup(true);
|
||||
};
|
||||
|
||||
const handlePopupClose = () => {
|
||||
|
|
@ -117,8 +116,9 @@ export function HeroSection() {
|
|||
setIsSubmitted(true);
|
||||
};
|
||||
|
||||
const handleWaitlistSubmit = async (data: { selected: string[]; other: string }) => {
|
||||
await submitWaitlistData(email, data);
|
||||
const handleWaitlistSubmit = (data: { selected: string[]; other: string }) => {
|
||||
// Fire and forget - don't block on logging failure
|
||||
submitWaitlistData(email, data).catch(console.error);
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -22,13 +22,15 @@ function isRateLimited(identifier: string): boolean {
|
|||
export async function submitEmail(email: string): Promise<{ success: boolean; error?: string }> {
|
||||
try {
|
||||
if (isRateLimited(email)) {
|
||||
console.warn('[WAITLIST] Rate limited:', email);
|
||||
return { success: false, error: 'Too many requests' };
|
||||
}
|
||||
|
||||
await storeMail(email);
|
||||
console.log('[WAITLIST] Email stored:', email);
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('Failed to store email:', error);
|
||||
console.error('[WAITLIST] Failed to store email:', email, error);
|
||||
return { success: false, error: 'Failed to save' };
|
||||
}
|
||||
}
|
||||
|
|
@ -39,9 +41,10 @@ export async function submitWaitlistData(
|
|||
): Promise<{ success: boolean; error?: string }> {
|
||||
try {
|
||||
await updateMail(email, data);
|
||||
console.log('[WAITLIST] Data updated:', email, data.selected);
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('Failed to update waitlist data:', error);
|
||||
console.error('[WAITLIST] Failed to update data:', email, error);
|
||||
return { success: false, error: 'Failed to save' };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue