Remembered contact details

Kept checkout contact info in localStorage and fixed webhook flow:
- Do not clear saved contact data on quote submission.
- Replaced no-cors webhook call with proper JSON payload handling and added response logging/validation.

X-Lovable-Edit-ID: edt-a167a9bd-57bc-43eb-b8f3-7b87551b581e
This commit is contained in:
gpt-engineer-app[bot] 2026-02-12 23:50:45 +00:00
commit 741fa856d2
2 changed files with 12 additions and 7 deletions

View file

@ -75,7 +75,7 @@ export function CartDrawer() {
clearCart();
setQuoteMessage('');
setContactInfo({ name: '', email: '', phone: '', company: '' });
// Keep contact info for next time (stored in localStorage)
setShowQuoteForm(false);
setIsCartOpen(false);
setHasSubmitted(false);

View file

@ -112,16 +112,21 @@ export async function sendQuoteWebhook(
try {
const response = await fetch(WEBHOOK_URL, {
method: 'POST',
mode: 'no-cors',
headers: { 'Content-Type': 'text/plain' },
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
signal: controller.signal,
});
// In no-cors mode, response is opaque (status 0, no body readable).
// If fetch didn't throw, the request was sent successfully.
console.log('📥 Webhook response type:', response.type);
console.log('📥 Webhook sent successfully (no-cors mode)');
const responseBody = await response.text();
console.log('📥 Webhook response status:', response.status);
console.log('📥 Webhook response body:', responseBody);
if (!response.ok) {
return {
success: false,
error: `Webhook returned status ${response.status}. Please try again.`,
};
}
return { success: true };
} catch (err: unknown) {