fix: web.config inheritInChildApplications, form error messages, docs infra
- web.config: aggiunto inheritInChildApplications=false per evitare che rewrite rules e httpErrors si propaghino alle Virtual Applications figlie - contatti.astro: errori HTTP 400 mostrano il messaggio specifico dell'API invece del messaggio generico - docs/INFRA.md: documentazione infrastruttura IIS e procedura di deploy Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -101,10 +101,11 @@ import Footer from '../components/Footer.astro';
|
||||
// ⚠️ Sostituire con l'URL reale dell'endpoint nella WebAPI
|
||||
const API_ENDPOINT = 'https://api.smart-roots.net/api/contatti';
|
||||
|
||||
const form = document.getElementById('contact-form') as HTMLFormElement;
|
||||
const submitBtn = document.getElementById('submit-btn') as HTMLButtonElement;
|
||||
const okMsg = document.getElementById('form-ok') as HTMLElement;
|
||||
const errMsg = document.getElementById('form-err') as HTMLElement;
|
||||
const form = document.getElementById('contact-form') as HTMLFormElement;
|
||||
const submitBtn = document.getElementById('submit-btn') as HTMLButtonElement;
|
||||
const okMsg = document.getElementById('form-ok') as HTMLElement;
|
||||
const errMsg = document.getElementById('form-err') as HTMLElement;
|
||||
const errMsgDefault = errMsg.innerHTML;
|
||||
|
||||
form.addEventListener('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
@@ -144,11 +145,17 @@ import Footer from '../components/Footer.astro';
|
||||
form.reset();
|
||||
okMsg.style.display = 'block';
|
||||
okMsg.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
} else if (response.status === 400) {
|
||||
const data = await response.json().catch(() => null);
|
||||
const msg = data?.Message || 'Dati non validi. Controlla i campi e riprova.';
|
||||
errMsg.textContent = msg;
|
||||
errMsg.style.display = 'block';
|
||||
} else {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Errore invio form:', err);
|
||||
errMsg.innerHTML = errMsgDefault;
|
||||
errMsg.style.display = 'block';
|
||||
} finally {
|
||||
submitBtn.disabled = false;
|
||||
|
||||
Reference in New Issue
Block a user